Skip to content

feat: add Discord bot integration for streak notifications#1337

Open
VIDYANKSHINI wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
VIDYANKSHINI:feat/discord-notifications
Open

feat: add Discord bot integration for streak notifications#1337
VIDYANKSHINI wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
VIDYANKSHINI:feat/discord-notifications

Conversation

@VIDYANKSHINI
Copy link
Copy Markdown
Contributor

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

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added discord_webhook_url, timezone, and last_discord_notification_at columns to the users table.
  • Added a "Discord Integration" section in src/app/dashboard/settings/page.tsx with a Webhook input, Timezone selector, and a "Test Notification" button.
  • Created a utility src/lib/discord.ts to format and send rich Discord Embed messages.
  • Created /api/user/settings/discord-test endpoint for sending test webhooks.
  • Added /api/notifications/discord-sync endpoint and an hourly cron job in vercel.json to evaluate local timezones and trigger daily/weekly notifications.
  • Updated src/app/api/user/settings/route.ts to handle Discord settings updates.

How to Test

Steps for the reviewer to verify this works:

  1. Create a Discord Webhook URL in your test server.
  2. Go to Settings, scroll down to Discord Integration.
  3. Paste the Webhook URL and select your timezone, then click Save Discord Settings.
  4. Click Test Notification and verify that a test embed appears in your Discord channel.
  5. (Optional) Run the local environment and manually trigger the /api/notifications/discord-sync endpoint with a valid CRON_SECRET header to test streak at-risk and milestone notifications.

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

Copilot AI review requested due to automatic review settings May 27, 2026 18:25
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

@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.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels May 27, 2026
@github-actions
Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add Discord bot integration for streak notifications

1 participant