Interaction emitting 2 times

So basically I have 4 buttons (3 for claim) and a reroll button (once an hour). if a user doesn't have enough currency to reroll it should tell him but he can still claim through the other buttons and here come the problem as the reroll button (should be always working not only for 10 minutes). for the 3 buttons i use a collector that works for 10 minutes only but for the reroll i use a the events. when a user reroll it-regenerate the buttons of claim but when trying to claim it run twice
7 Replies
d.js toolkit
d.js toolkit•3w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Youssef
YoussefOP•3w ago
SourceBin
Code that handle buttons
Instantly share your code with the world.
Youssef
YoussefOP•3w ago
SourceBin
Reroll
Instantly share your code with the world.
Youssef
YoussefOP•3w ago
SourceBin
Reroll from events
Instantly share your code with the world.
Youssef
YoussefOP•3w ago
Yes thats basically the problem, 🤷 but im not sure how to disable the first collector when the 10 minutes cooldown are not passed and a user click the reroll that runs through the events
d.js docs
d.js docs•3w ago
:method: Collector#stop() @14.16.3 Stops this collector and emits the end event.
Youssef
YoussefOP•3w ago
well the thing is with this approach, that when you click the reroll command there is 2 possibilities: - You have currency and you're not on cooldown so you can reroll and have new buttons to claim - You don't have currency so it just tell you "you can't reroll". but you can still claim from the other 3 buttons that work with the collector => So of i disable and we are on possibility number 2, user can't claim from his original buttons what do you suggest?
Want results from more Discord servers?
Add your server