1
0
Fork 0
Commit graph

12 commits

Author SHA1 Message Date
02ef9f4954 feat(bot): add staff-only /debug command for previewing and reposting bot messages 2026-10-26 18:07:05 -04:00
8d5aa081ba fix(bot): read open-ended changelog ranges in the newest direction
CHANGELOG.md is newest-first, but resolveChangelogRange treated its two
range ends as a closed min/max index pair. A range with only a starting
version ("0.6.0..") therefore resolved to the oldest entries through
0.6.0 instead of 0.6.0 and everything newer, so the release-notes command
announced the wrong set of releases.

Resolve each open end toward the direction it opens: "X.." runs from the
newest entry down to X, "..X" runs from X to the oldest entry, and a
closed range still normalizes to min/max. Adds a regression test against
the shipped file.
2026-10-13 11:18:24 -04:00
8148aeb22d feat(bot): add editable Discord Rich Presence via command and CMS
Adds a discord-presence Payload Global as the single source of truth for the bot's Discord activity. Two writers update it and either takes effect live: the admin CMS page and the /discord-presence command (view/edit/clear, guild-only, gated by new discord:rp:read and discord:rp:update permissions). A poll loop reconciles Discord's live presence from the Global so CMS edits propagate without a restart; disabled or blank presence sets the bot idle.
2026-10-12 10:21:37 -04:00
6df285e2e8 feat(changelog): render section headers as Discord markdown headings 2026-10-11 17:27:51 -04:00
a1ab247b7b feat(minigames): notify winners and announce achievements on Discord
Phase 6 of the minigame periods feature:

- Muteable `minigame:achievement` notification type; the close pipeline now
  notifies each winner in-app, but only when the achievement row is newly
  written, so a re-run or a concurrent closer never double-sends.
- New bot service `achievementAnnouncements` polls achievements with no
  announcedAt, groups them by window, posts ONE embed per window to
  DISCORD_ANNOUNCE_CHANNEL_ID, then stamps announcedAt + discordMessageId.
  A failed post leaves the rows unannounced so the next tick retries them.
- Pure, testable renderer (bot/lib/achievementRender.ts) for grouping and the
  embed shape; window labels reuse the period/calendar helpers.
- Register the service in the bot registry and add
  DISCORD_ACHIEVEMENT_POLL_MS (default 60s).
- Tests: renderer grouping/ordering/fallbacks and the in-app notification
  path (including idempotency).
2026-10-11 17:06:52 -04:00
88d1d1f6f1 feat(changelog): fall back to a generic line for empty entries and sections 2026-10-11 16:41:04 -04:00
6bc7413cd7 fix(bot): acknowledge /changelog immediately and surface post-defer errors
Defer the reply before the permission check (uncached member fetch + DB
lookups) so a slow preamble no longer trips Discord's 3-second window and
shows "The application did not respond". Wrap all post-defer work in one
try/catch that editReplies an error, and make channel resolution catch fetch
errors so an unreachable DISCORD_CHANGELOG_CHANNEL_ID replies clearly instead
of hanging the interaction.

Also export compareVersions and make the shipped-file test assert
newest-first rather than a hardcoded version.
2026-10-10 15:57:51 -04:00
9a0b78fcf0 feat(bot): support version ranges in /changelog
/changelog now accepts an inclusive range via from..to notation: v0.3.0..v0.5.0
(an inclusive slice, output oldest-to-newest), either end open (v0.3.0.. to the
latest, ..v0.5.0 from the oldest), and reversed ranges are normalized. Each
version posts as its own amber embed. Ranges over 10 versions warn but proceed.
2026-10-10 13:13:55 -04:00
2e23d074a4 feat(bot): add /changelog command to post release notes to Discord
Posts a CHANGELOG.md release entry to #releases (new DISCORD_CHANGELOG_CHANNEL_ID,
falls back to the announce channel). /changelog targets the latest entry;
/changelog <version> targets a specific version for catch-up.

Rendering is a pure, tested module (bot/lib/changelogRender.ts): entries are
split on "# vX.Y.Z" headers, ### sections become bold, bullets become the
bullet glyph, and entries over Discord's 4096-char limit are split across
messages at section/bullet boundaries with the header re-attached to each
chunk. Guild-scoped, staff-only command.
2026-10-09 19:01:21 -04:00
9001d5a796 feat(bot): Add assignment transfer bot services
Add Discord bot services for assignment transfer interactions:

1. transferInteractions.ts: Handle button interactions for transfer requests,
   approvals, rejections, appeals, completions, and cancellations.

2. transferRequests.ts: Poll for pending assignment transfers and trigger
   notification delivery to Discord when status changes to pending/approved/rejected.

3. transferDelivery.ts: Deliver transfer notifications to users via DMs with
   embeds showing status, details, and actions (approve/reject/appeal).

4. transferMessaging.ts: Provide Discord embed building for transfer messages
   with status badges and action buttons.

5. Update bot index.ts: Add transfer button interaction handler with customId prefix "ptf-xfer:"

6. Update notificationBridge.ts: Exclude transfer notification types from general
   notification polling to avoid duplication (Phase 2 feature).

Integration: Services are started via src/bot/services/index.ts and run alongside
existing mission and notification services.
2026-08-31 23:40:21 -04:00
d3890cc191 feat(discord): integrate RBAC into Discord bot
Replace legacy role-name checks in isStaff with hasPermission(discord:staff).
Auto-assign the 'user' role document on signup. Import hasPermission in
announce command for future permission gating.
2026-08-19 19:48:28 -04:00
00919ceeb3 feat(bot): add Discord bot scaffold with sign-up, attendance embeds, and notification bridge 2026-08-12 12:39:00 -04:00