• 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
/
Code
/
Search
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_CHANNEL_IDS (required): Comma-separated Discord channel IDs to summarize
  • DISCORD_USER_TOKEN (required): Your personal Discord token

Optional:

  • DISCORD_INCLUDE_BOTS: set to "1" to include bot messages (default: exclude bots)
  • DISCORD_MAX_MESSAGES: max messages per channel included from the last 24h (default: 750)
  • DISCORD_MAX_THREADS: max threads/posts per channel to scan (default: 20) — important for Forum channels where replies live in threads
  • OPENAI_MODEL: OpenAI model name (default: gpt-4o-mini)

How to get DISCORD_CHANNEL_IDS

  1. In Discord, go to User Settings → Advanced and enable Developer Mode.
  2. Right-click the channels you want to summarize.
  3. Click Copy Channel ID for each and separate them with commas (e.g., 123,456).

About Discord user tokens

Discord user tokens (personal account tokens) allow the val to access channels your account has access to.

Use with caution:

  • Risky: Automated use of user tokens ("self-botting") is against Discord's Terms of Service and can result in your account being flagged or banned.
  • Sensitive: A user token is effectively your password. Never share it or commit it to a public repository.

To use a user token:

  1. Set DISCORD_USER_TOKEN to your personal token in Val Town Secrets.
  2. Note: This val only reads message history, which is generally lower risk than automated posting, but still carries the risks mentioned above.

https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs/Token-and-IDs.md

Notes

  • Forum channels and threaded replies:
    • If you point DISCORD_CHANNEL_IDS at a Forum channel, this val will scan the forum’s threads/posts (plus recent archived threads) and summarize per-thread “conversations”.
    • For normal text channels, it will summarize the main channel timeline and also scan any discovered active/recent threads (up to DISCORD_MAX_THREADS).
  • 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).
Code
README.md
C
index.cron.ts
index.ts
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.