auto-thread
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v32View latest version
Automatically creates Discord threads from new messages in configured channels, using OpenAI to generate descriptive thread titles.
Rendering mermaid diagram...
| File | Type | Purpose |
|---|---|---|
main.ts | interval | Core loop: poll channels → generate title → create thread |
sqlite.ts | script | Track last-processed message ID per channel |
- Set
DISCORD_BOT_TOKENenv var - Edit
WATCH_CHANNELSinmain.tswith your channel IDs - Set the interval schedule
VIEW_CHANNELREAD_MESSAGE_HISTORYSEND_MESSAGESCREATE_PUBLIC_THREADSSEND_MESSAGES_IN_THREADS
npm:@discordjs/rest— Discord REST API with rate limiting and retriesnpm:discord-api-types— Full TypeScript types for the Discord APIstd/openai— Val Town's OpenAI wrapperstd/sqlite— Val Town's project-scoped SQLite
