TARS - Discord Contest Bot
A multi-tenant Discord bot built with Bun and Effect-TS . Provides daily contest digests, real-time rating tracking, and AI-powered features for competitive programmers.
Daily Digests: Automatically posts upcoming Codeforces & AtCoder contests each day.
Rating Tracking: Monitors handles and announces improvements with AI-generated motivational quotes.
Random Problems: /random picks a Codeforces problem suited to your current rating.
AI Excuses: !oops generates a deadpan excuse for why you're not competing today.
Multi-Tenant: Each channel has its own timezone, delivery time, and tracked handles.
Persistent: Uses Redis for exactly-once digest delivery and tracking history.
Setup & Local Development
Bun: curl -fsSL https://bun.sh/install | bash
Redis: A running Redis instance (v5+)
Create an application on the Discord Developer Portal .
Go to Bot → reset/copy your Token .
Go to General Information → copy Application ID and Public Key .
Set Interactions Endpoint URL to https://<your-domain>/api/webhooks/discord.
Under Bot → Privileged Gateway Intents , enable Message Content Intent .
cp .env.example .env
# Fill in DISCORD_BOT_TOKEN, DISCORD_PUBLIC_KEY, DISCORD_APPLICATION_ID, REDIS_URL, GROQ_API_KEY
bun install
bun run dev # Development with hot-reload
bun run start # Production
Build Command: bun install
Start Command: bun run start
Add all variables from .env.example to your hosting environment.
Keep-Alive: Set SELF_USAGE_URL to your app's public URL to ping /health every 10 minutes and prevent sleep on free-tier hosts.
Command
Description
/setup time:<HH:MM> timezone:<IANA>
Enable digests in this channel
/disable
Stop scheduled digests
/time value:<HH:MM>
Change delivery time
/timezone value:<IANA>
Change timezone
/test-digest
Preview tomorrow's digest
Command
Description
/status
Digest schedule and service status
/today
Contests happening today
/tomorrow
Tomorrow's contests
/upcoming days:<n>
Contests over the next N days (default 7)
/next
The very next upcoming contest
/lucky
Random contest pick from tomorrow's pool
Command
Description
/track-add platform:<...> handle:<...>
Start tracking a handle
/track-remove platform:<...> handle:<...>
Stop tracking a handle
/track-list
List tracked handles in this channel
/leaderboard
Top 10 rated users in this channel
/rating platform:<...> handle:<...>
Current rating for a handle
/compare platform:<...> handle_a:<...> handle_b:<...>
Compare two handles
/streak platform:<...> handle:<...>
Recorded rating improvements for a handle
/random
Random Codeforces problem at your rating
Command
Description
!oops
AI-generated excuse for not competing today
bun test
bun run typecheck