Buttons Expiring

My buttons expire. I use interaction event to make them permanent but it does not work.
48 Replies
d.js toolkit
d.js toolkit8mo 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! - Marked as resolved by OP
Crocodile
Crocodile8mo ago
No description
Crocodile
Crocodile8mo ago
Here is my code and what i mean by expiring is that they do not work after restart. No errors. no anything in console.
Ashish
Ashish8mo ago
Any errors?
Crocodile
Crocodile8mo ago
Nope. Just they expire when I turn off the bot.
Ashish
Ashish8mo ago
Also, I have a few issues with this code. You have multiple client.on() for the Events.InteractionCreate event, you should only have 1. Use if checks inside the event to figure what each button does
Crocodile
Crocodile8mo ago
Alright how do I configure my code to make it like this.
Ashish
Ashish8mo ago
This won't solve the issue, but it will make it better:
client.on(Events.InteractionCreate, async interaction => {
if (interaction.customId === "firstButton") {
// code here
} else if (interaction.customId === "secondButton") {
// other code here
}
})
client.on(Events.InteractionCreate, async interaction => {
if (interaction.customId === "firstButton") {
// code here
} else if (interaction.customId === "secondButton") {
// other code here
}
})
Secondly, does your bot just not reply, or does it not do anything? Like does it create a channel?
Crocodile
Crocodile8mo ago
It makes the channel in the specific category it works perfectly fine. It just doesn't stay on after the bot restarts.
Ashish
Ashish8mo ago
Meaning if you restart the bot and press the button, it just says Interaction Failed?
Crocodile
Crocodile8mo ago
Yes.
Ashish
Ashish8mo ago
And bot doesn't do anything else as well, is what I understand
Crocodile
Crocodile8mo ago
but if I keep the bot on from the start it works. So. I type in ping to make it send the message. It sends and I can use all the buttons.
Ashish
Ashish8mo ago
How fast do you press the button after the bot restarts? Because it might be possible that the bot is still booting up
Want results from more Discord servers?
Add your server