Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reply to the interaction has already been sent or deferred #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tithanayut
Copy link
Member

There were multiple occurrences of this issue

Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
    at ButtonInteraction.update (/Users/thana/development/thinc-discord-bot/node_modules/.pnpm/[email protected]/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:225:46)
    at PostInteractionCollector.confirmRegistration (/Users/thana/development/thinc-discord-bot/src/discord/commands/register/register.collector.ts:81:23)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at PostInteractionCollector.onCollect (/Users/thana/development/thinc-discord-bot/src/discord/commands/register/register.collector.ts:26:7)

It seems that confirmRegistration is ran twice for each user confirmation. With the following code in discord.js, await interaction.update throws an error on the second run.

if (this.deferred || this.replied) throw new DiscordjsError(ErrorCodes.InteractionAlreadyReplied);

I am unfamiliar with discord.js and Discord API in general to determine why it run twice.

This PR applies temporary fix for the issue. Expected registration flow is still runnable.

@tithanayut tithanayut requested a review from saenyakorn October 20, 2023 17:19
@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2023

🦋 Changeset detected

Latest commit: 8a10454

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
thinc-discord-bot Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

1 participant