Skip to content

feat: add DM notification preferences and code detection alerts#29

Merged
BigMichi1 merged 1 commit into
mainfrom
feat/dm-notification-preferences
May 15, 2026
Merged

feat: add DM notification preferences and code detection alerts#29
BigMichi1 merged 1 commit into
mainfrom
feat/dm-notification-preferences

Conversation

@BigMichi1
Copy link
Copy Markdown
Owner

@BigMichi1 BigMichi1 commented May 15, 2026

  • Add dmOnCode, dmOnSuccess, dmOnFailure columns to users table
  • Generate migration 0005_grey_saracen for new columns
  • Add getDiscordIdsWithDmOnCode() and setNotificationPreferences() to userManager
  • DM code-detected users in bot.ts MessageCreate handler
  • Gate auto-redeem success DM on dmOnSuccess preference
  • Send failure DM when dmOnFailure preference is enabled
  • Add /notifications command to view and update preferences
  • Register /notifications in bot.ts command list
  • Add /notifications entry to /help command

Copilot AI review requested due to automatic review settings May 15, 2026 06:28
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

✅ Coverage Report

Metric Value
Current coverage 54.17% (928/1713)
Baseline coverage 48.45% (737/1521)
Result PASS

New Files

File Coverage Lines Status
src/bot/commands/notifications.test.ts SKIP (ignored)
src/bot/commands/notifications.ts 97.39% 112/115 PASS

Changed Files

File Baseline Current Status
src/bot/bot.ts N/A N/A SKIP (new to coverage)
src/bot/commands/help.ts N/A N/A SKIP (new to coverage)
src/bot/database/codeManager.test.ts SKIP (ignored)
src/bot/database/codeManager.ts 73.71% 77.18% PASS
src/bot/database/schema/users.ts 100.00% 100.00% PASS
src/bot/database/userManager.test.ts SKIP (ignored)
src/bot/database/userManager.ts 91.75% 93.04% PASS
src/bot/handlers/autoRedeemer.test.ts SKIP (ignored)
src/bot/handlers/autoRedeemer.ts 88.73% 92.02% PASS

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds per-user DM notification preferences (code detected, redeem success, redeem failure) backed by three new boolean columns on users, a new /notifications slash command to view/update them, and DM fan-outs in the MessageCreate handler and auto-redeemer that respect the new flags.

Changes:

  • Schema + migration 0005_grey_saracen adding dm_on_code, dm_on_success, dm_on_failure and matching UserCredentials fields / getAllUsersWithDmOnCode + setNotificationPreferences helpers.
  • New /notifications command (with /help entry and registration in bot.ts).
  • DM fan-out on code detection in MessageCreate, and gating of success/failure DMs in autoRedeemer.ts on the new preferences.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/bot/database/schema/users.ts Adds three boolean preference columns.
src/bot/database/migrations/0005_grey_saracen.sql SQLite migration for the new columns.
src/bot/database/migrations/meta/0005_snapshot.json Drizzle snapshot for migration 0005.
src/bot/database/migrations/meta/_journal.json Registers the new migration entry.
src/bot/database/userManager.ts Adds NotificationPreferences, defaults in row mapper, getAllUsersWithDmOnCode, and setNotificationPreferences.
src/bot/handlers/autoRedeemer.ts Gates success DM on dmOnSuccess; sends failure DM when dmOnFailure is enabled.
src/bot/bot.ts Registers /notifications and DMs opted-in users when codes are detected.
src/bot/commands/notifications.ts New slash command to view/update preferences.
src/bot/commands/help.ts Adds /notifications to the help embed.
IDEAS/TODO.md Marks the DM/notification ideas as implemented.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/database/userManager.ts Outdated
Comment thread src/bot/handlers/autoRedeemer.ts Outdated
Comment thread src/bot/handlers/autoRedeemer.ts Outdated
Comment thread src/bot/commands/notifications.ts Outdated
Copilot AI review requested due to automatic review settings May 15, 2026 06:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/handlers/autoRedeemer.ts Outdated
Comment thread src/bot/bot.ts
Comment thread src/bot/database/userManager.ts
Comment thread src/bot/handlers/autoRedeemer.ts
Comment thread src/bot/handlers/autoRedeemer.test.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.

Comment thread src/bot/handlers/autoRedeemer.ts
Comment thread src/bot/handlers/autoRedeemer.ts Outdated
Comment thread src/bot/database/userManager.ts Outdated
Comment thread src/bot/database/userManager.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/handlers/autoRedeemer.ts
Copilot AI review requested due to automatic review settings May 15, 2026 07:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 8 comments.

Comment thread src/bot/commands/notifications.test.ts Outdated
Comment thread src/bot/database/userManager.ts
Comment thread src/bot/handlers/autoRedeemer.ts
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts
Comment thread src/bot/database/userManager.ts Outdated
Comment thread src/bot/commands/notifications.ts
Comment thread src/bot/commands/notifications.ts Outdated
Copilot AI review requested due to automatic review settings May 15, 2026 07:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.

Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/database/userManager.ts
Comment thread src/bot/handlers/autoRedeemer.ts Outdated
Comment thread src/bot/handlers/autoRedeemer.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.

Comment thread src/bot/commands/help.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/database/codeManager.ts Outdated
Comment thread src/bot/handlers/autoRedeemer.test.ts
Comment thread src/bot/commands/notifications.ts Outdated
Comment thread src/bot/commands/notifications.ts Outdated
Copilot AI review requested due to automatic review settings May 15, 2026 08:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.

Comment thread src/bot/database/codeManager.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/bot.ts Outdated
Comment thread src/bot/handlers/autoRedeemer.ts Outdated
Comment thread src/bot/commands/notifications.ts Outdated
Copilot AI review requested due to automatic review settings May 15, 2026 08:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.

Comment thread src/bot/bot.ts
Comment thread src/bot/handlers/autoRedeemer.ts
Comment thread src/bot/handlers/autoRedeemer.ts
Comment thread src/bot/database/userManager.ts
Comment thread src/bot/bot.ts
Comment thread src/bot/database/codeManager.ts
Signed-off-by: Michael Cramer <michael@bigmichi1.de>
@BigMichi1 BigMichi1 force-pushed the feat/dm-notification-preferences branch from 44500a7 to eee2e86 Compare May 15, 2026 08:45
@BigMichi1 BigMichi1 merged commit 7fc7c07 into main May 15, 2026
12 checks passed
@BigMichi1 BigMichi1 deleted the feat/dm-notification-preferences branch May 15, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants