Public
Like
discordDailyDigest
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: v3View latest version
Daily cron val that:
- Fetches messages from a Discord channel (last 24 hours)
- Summarizes them with Val Town's OpenAI integration
- Emails the digest to you (the logged-in Val Town user)
Set these in Val Town Secrets for this val:
DISCORD_BOT_TOKEN(required): Discord bot tokenDISCORD_CHANNEL_ID(required): Discord channel ID to summarize
Optional:
DISCORD_INCLUDE_BOTS: set to"1"to include bot messages (default: exclude bots)DISCORD_MAX_MESSAGES: max messages included from the last 24h (default:750)OPENAI_MODEL: OpenAI model name (default:gpt-4o-mini)
- In Discord, go to User Settings → Advanced and enable Developer Mode.
- Right-click the channel you want to summarize.
- Click Copy Channel ID.
- Go to the Discord Developer Portal:
https://discord.com/developers/applications - Create an application (or pick an existing one).
- Go to Bot → Reset Token → copy the token.
- In Bot → Privileged Gateway Intents, enable Message Content Intent (recommended; otherwise
contentmay be empty/limited). - Invite the bot to your server:
- OAuth2 → URL Generator
- Scopes:
bot - Bot permissions: at least View Channels + Read Message History
Also ensure, in the server/channel, the bot role has permission to read the target channel.
- This val intentionally has no idempotency guard: it will email every time it runs.
- On Val Town Free, the
v/std/emailhelper can only email yourself (works fine for this use case).