Skip to content

Implement: vpc-bot-raffle-fix.md - #5

Merged
emb417 merged 1 commit into
mainfrom
vault-spec/vpc-bot-raffle-fix
Aug 29, 2026
Merged

emb417 merged 1 commit into
mainfrom
vault-spec/vpc-bot-raffle-fix

Conversation

@emb417

@emb417 emb417 commented Aug 29, 2026

Copy link
Copy Markdown
Owner

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 by src/services/scheduler.js), attempts to display the final raffle board using showRaffleBoard from src/commands/raffle/show-raffle-board.js. The showRaffleBoard function expects the passed interaction object to have a deferReply method, which is standard for Discord interactions (slash commands, button presses).

However, runRaffleAndCreateNextWeek constructs a mockInteraction object that lacks the deferReply and editReply methods directly on the object. While it defines reply and followUp methods, these are not called by showRaffleBoard for its primary message flow. This discrepancy leads to a TypeError: 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

  • The weekly raffle board is successfully displayed in the COMPETITION_CHANNEL_ID by the bot when the WEEKLY_CRON_SCHEDULE task runs.
  • The TypeError: interaction.deferReply is not a function no longer appears in the bot's logs when the scheduled raffle task executes.
  • The /show-raffle-board slash command continues to function as expected.
  • The show_raffle_board button listener in src/listeners/components/showRaffleBoard.js continues to function as expected.

Notes for implementer

  • Focus on modifying the mockInteraction object within src/lib/raffle/raffleWinner.js.
  • The mockInteraction needs to implement deferReply and editReply methods to mimic the behavior of a real Discord Interaction as expected by showRaffleBoard.
  • For deferReply, it can be a simple no-op that just sets mockInteraction.deferred = true; or similar, as there isn't a Discord API interaction to defer with in this context.
  • For editReply, this method should handle sending the content or embeds to the channel that is already available in the mockInteraction object. This will effectively replace how showRaffleBoard tries to update its message.

@emb417 emb417 added the patch Patch-level semver bump label Aug 29, 2026
@emb417
emb417 merged commit f457fd3 into main Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Patch-level semver bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant