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

Add an option to create message collectors instead of only creating channel ones #922

Closed
LcsGa opened this issue Nov 20, 2022 · 2 comments · Fixed by #973
Closed

Add an option to create message collectors instead of only creating channel ones #922

LcsGa opened this issue Nov 20, 2022 · 2 comments · Fixed by #973
Labels
duplicate This issue or pull request already exists

Comments

@LcsGa
Copy link

LcsGa commented Nov 20, 2022

Is your feature request related to a problem? Please describe.
I'm writing a command:

  • It sends a button that can be clicked by any user
  • On each click, the bot reacts by sending some ephemeral messages to the user who clicked
  • As the user keeps clicking, the button won't be easily reachable anymore
  • The user rewrites the command to create a new button
    => On a new click, we receive a DiscordApiError due to the fact that the collector is on channels only
node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:497
                                throw new DiscordAPIError(data, 'code' in data ? data.code : data.error, status, method, url, requestData);
          ^
DiscordAPIError[40060]: Interaction has already been acknowledged.
    at SequentialHandler.runRequest (/home/lucas/dev/fishing-bot/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:497:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at SequentialHandler.queueRequest (/home/lucas/dev/fishing-bot/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:198:11)
    at REST.request (/home/lucas/dev/fishing-bot/node_modules/@discordjs/rest/src/lib/REST.ts:343:20)
    at ButtonInteraction.deferReply (/home/lucas/dev/fishing-bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:69:5)

It is due to channel collectors returning component interactions for any component within that channel.

Describe the solution you'd like
add on option to do <Message>.createMessageComponentCollector(…) in addition to <Channel>.createMessageComponentCollector(…) (currently the only option)

Describe alternatives you've considered
The only alternative I would have would be sending many / commands to replace that button, which is not what I'd like

@LcsGa
Copy link
Author

LcsGa commented Nov 20, 2022

The use of <Channel>.createMessageComponentCollector(…) can be found here:

messageOrInteraction.channel.createMessageComponentCollector(

@fjodor-rybakov fjodor-rybakov added bug Something isn't working enhancement New feature or request labels Jan 15, 2023
@fjodor-rybakov
Copy link
Owner

Duplicate #868

@fjodor-rybakov fjodor-rybakov added duplicate This issue or pull request already exists and removed bug Something isn't working enhancement New feature or request labels Jan 27, 2023
@fjodor-rybakov fjodor-rybakov linked a pull request Jan 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants