brackt/app/services
Chris Parsons fbcecb490e
Add Discord draft pick announcements (#460)
* Add Discord draft pick announcements

Posts a message to the league Discord webhook each time a pick is made, announcing the picked participant and pinging the next team on the clock if their owner has opted into Discord notifications. Enabled via a separate toggle in league settings (independent from standings update notifications).

https://claude.ai/code/session_01Tvwsv3LfL9JUqxoLct8dTn

* Address code review feedback on Discord pick announcements

- Fix "on the clock" timing: read currentPickNumber fresh from DB post-autodraft-chain (matches sendOnTheClockEmail guarantee)
- Remove outer try/catch from notifyPickMadeOnDiscord so callers' .catch() is not dead code
- Add missing draft-discord.server.test.ts with 12 tests covering all early-exit and happy paths
- Fix silent empty-string fallback for missing pickedSlot: warn and skip instead
- Eliminate sequential season→league DB queries by accepting leagueId as a direct param
- Show "save webhook URL to configure options" hint when URL is typed but not yet saved
- Remove block-scope braces at both call sites (plain const declarations)
- Remove redundant "Round N, Pick M" description line (title already carries this info)
- Inline pickInRoundFor helper to avoid circular import with draft-utils

https://claude.ai/code/session_01Tvwsv3LfL9JUqxoLct8dTn

* Fix lint errors from review fixes

- Remove unused logger import (no longer needed after removing try/catch)
- Remove unused OWNER_ID constant in test fixture
- Use toSorted() instead of sort() in sendDraftOrderNotification

https://claude.ai/code/session_01Tvwsv3LfL9JUqxoLct8dTn

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-20 19:55:48 -07:00
..
__tests__ Add Discord draft pick announcements (#460) 2026-05-20 19:55:48 -07:00
simulations Add not-participating exclusion support for event results (#446) 2026-05-19 11:13:32 -07:00
standings-sync Add MLS standings sync and fix simulator conference resolution (#423) 2026-05-14 15:39:40 -07:00
bracket-simulator.ts Replace console.* with structured logger, fix no-inferrable-types (closes #98) (#199) 2026-03-21 13:41:39 -07:00
brackt.server.ts Add Brackt as a league-private meta-sport (#200) (#377) 2026-05-04 20:31:44 -07:00
discord.ts Add Discord draft pick announcements (#460) 2026-05-20 19:55:48 -07:00
draft-autostart.ts Add auto-start draft at scheduled time (#437) (#438) 2026-05-16 23:37:29 -07:00
draft-discord.server.ts Add Discord draft pick announcements (#460) 2026-05-20 19:55:48 -07:00
draft-email.server.ts Add draft email notifications feature (#459) 2026-05-20 15:35:43 -07:00
ev-calculator.ts fix: address VORP code review issues (#283) 2026-04-08 23:20:02 -04:00
icm-calculator.ts Replace console.* with structured logger, fix no-inferrable-types (closes #98) (#199) 2026-03-21 13:41:39 -07:00
probability-engine.ts Fix NCAAW futures odds simulation and admin import UX (#420) 2026-05-13 01:06:16 -07:00
probability-updater.ts Canonical tournament layer: schema + backfill (1/2) (#365) 2026-05-01 20:13:18 -07:00
sync-tournament-results.ts Canonical tournament layer: 2026-05-01 21:04:48 -07:00