Implement: vpc-bot-raffle-fix.md - #5
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-generated from vault spec
notes/vpc-bot-raffle-fix.md.Fix raffle bot
Please ensure the raffle bot is running as expected and that the raffle board is being shown correctly. Here are the logs from the bot:
[2026-08-24 00:00:00] INFO: Running scheduled raffle and new week creation...
[2026-08-24 00:00:00] INFO: Running weekly raffle and creating next week...
[2026-08-24 00:00:01] ERROR: Failed to show raffle board:
err: {
"type": "TypeError",
"message": "interaction.deferReply is not a function",
"stack":
TypeError: interaction.deferReply is not a function
at showRaffleBoard (file:///app/src/commands/raffle/show-raffle-board.js:59:23)
at runRaffleAndCreateNextWeek (file:///app/src/lib/raffle/raffleWinner.js:60:13)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
at async cron.schedule.scheduled (file:///app/src/services/scheduler.js:79:9)
at async Timeout._onTimeout (/app/node_modules/node-cron/dist/esm/scheduler/runner.js:70:44)
}
[2026-08-24 00:00:02] INFO: Raffle winner selected: burgereater289 with table Barb Wire (Gottlieb 1996) (VPS ID: 8puRqHeyal)
[2026-08-24 00:00:03] INFO: New competition week created successfully.
[2026-08-24 00:05:00] INFO: Running daily tournament maintenance...
[2026-08-24 00:05:00] INFO: Auto-ended tournament "Joe Joos Jr" (#tournament-corner) — winner: autobott (75 pts)
[2026-08-24 00:05:03] INFO: Announced and pinned tournament "Ritchie's High Speeds"
Expanded Spec
Problem
The raffle bot's weekly scheduled task,
runRaffleAndCreateNextWeek(triggered bysrc/services/scheduler.js), attempts to display the final raffle board usingshowRaffleBoardfromsrc/commands/raffle/show-raffle-board.js. TheshowRaffleBoardfunction expects the passedinteractionobject to have adeferReplymethod, which is standard for Discord interactions (slash commands, button presses).However,
runRaffleAndCreateNextWeekconstructs amockInteractionobject that lacks thedeferReplyandeditReplymethods directly on the object. While it definesreplyandfollowUpmethods, these are not called byshowRaffleBoardfor its primary message flow. This discrepancy leads to aTypeError: interaction.deferReply is not a function, preventing the raffle board from being shown correctly in the competition channel during the automated weekly run. Despite this error, the raffle winner is still selected, and the new competition week is created.Acceptance Criteria
COMPETITION_CHANNEL_IDby the bot when theWEEKLY_CRON_SCHEDULEtask runs.TypeError: interaction.deferReply is not a functionno longer appears in the bot's logs when the scheduled raffle task executes./show-raffle-boardslash command continues to function as expected.show_raffle_boardbutton listener insrc/listeners/components/showRaffleBoard.jscontinues to function as expected.Notes for implementer
mockInteractionobject withinsrc/lib/raffle/raffleWinner.js.mockInteractionneeds to implementdeferReplyandeditReplymethods to mimic the behavior of a real DiscordInteractionas expected byshowRaffleBoard.deferReply, it can be a simple no-op that just setsmockInteraction.deferred = true;or similar, as there isn't a Discord API interaction to defer with in this context.editReply, this method should handle sending the content or embeds to thechannelthat is already available in themockInteractionobject. This will effectively replace howshowRaffleBoardtries to update its message.