feat: add Discord bot integration for streak notifications#1337
feat: add Discord bot integration for streak notifications#1337VIDYANKSHINI wants to merge 4 commits into
Conversation
|
@VIDYANKSHINI is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
|
Thanks @VIDYANKSHINI for the Discord integration! The code itself looks solid (Discord webhook lib, settings UI, Supabase migration). However, there's one critical issue: The cron schedule Vercel Hobby plan only allows cron jobs with daily or less frequent schedules ( Please change the Discord sync cron to: { "path": "/api/notifications/discord-sync", "schedule": "0 0 * * *" }Once you update this, we can merge! |
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Hi @VIDYANKSHINI! The Discord streak notification feature is well-implemented! One blocker: the vercel.json cron uses 0 * * * * (hourly) but the project is on Vercel's Hobby plan which only supports daily or less-frequent crons. Please change it to daily: 0 20 * * * (8 PM UTC daily) or similar. Thanks!
2517d8f to
a9a13da
Compare
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
This PR has 6 merge conflicts with current main and needs a rebase. Additionally, please check any cron schedules added are Hobby-plan compatible (daily 0 0 * * * or weekly, not hourly).
a9a13da to
2e37355
Compare
Summary
This PR implements the Discord bot integration for streak notifications. It allows users to connect a Discord Webhook URL in their settings and select their local timezone. A background cron job checks hourly and sends a "streak at risk" notification at 8 PM in the user's local timezone if they haven't committed that day. It also sends milestone alerts and a weekly coding summary on Sundays.
Closes #1062
Type of Change
Changes Made
discord_webhook_url,timezone, andlast_discord_notification_atcolumns to theuserstable.src/app/dashboard/settings/page.tsxwith a Webhook input, Timezone selector, and a "Test Notification" button.src/lib/discord.tsto format and send rich Discord Embed messages./api/user/settings/discord-testendpoint for sending test webhooks./api/notifications/discord-syncendpoint and an hourly cron job invercel.jsonto evaluate local timezones and trigger daily/weekly notifications.src/app/api/user/settings/route.tsto handle Discord settings updates.How to Test
Steps for the reviewer to verify this works:
/api/notifications/discord-syncendpoint with a validCRON_SECRETheader to test streak at-risk and milestone notifications.Checklist
npm run lintpasses locallynpm run type-check)