• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
laszlocph

laszlocph

discordDailyDigest

Daily Discord digest email
Public
Like
discordDailyDigest
Home
Code
3
README.md
C
index.cron.ts
index.ts
Branches
1
Pull requests
Remixes
History
Environment variables
3
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v3
View latest version
README.md

discordDailyDigest

Daily cron val that:

  1. Fetches messages from a Discord channel (last 24 hours)
  2. Summarizes them with Val Town's OpenAI integration
  3. Emails the digest to you (the logged-in Val Town user)

Secrets / env vars

Set these in Val Town Secrets for this val:

  • DISCORD_BOT_TOKEN (required): Discord bot token
  • DISCORD_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)

How to get DISCORD_CHANNEL_ID

  1. In Discord, go to User Settings → Advanced and enable Developer Mode.
  2. Right-click the channel you want to summarize.
  3. Click Copy Channel ID.

How to get DISCORD_BOT_TOKEN

  1. Go to the Discord Developer Portal: https://discord.com/developers/applications
  2. Create an application (or pick an existing one).
  3. Go to Bot → Reset Token → copy the token.
  4. In Bot → Privileged Gateway Intents, enable Message Content Intent (recommended; otherwise content may be empty/limited).
  5. 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.

Notes

  • This val intentionally has no idempotency guard: it will email every time it runs.
  • On Val Town Free, the v/std/email helper can only email yourself (works fine for this use case).
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.