Making interactions persistent after bot restart
I'm using discord.js 14.3, node v18.9.0.
I'd like to create a ticketing system where the user can click a button to open a ticket. Ideally, I'd like to have the embed with those buttons pinned in a channel, and for that message to stay there indefinitely. Is there a way to make those buttons still work after the bot is restarted?
At the moment, it seems like if the embed is interacted with after the bot is restarted/goes offline, the interaction fails.
8 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.
Documentation suggestion for @dustbunnythumper: (event) Client#interactionCreate
Emitted when an interaction is created.It seems like if I interact with a message that was posted before the bot is restarted, interactionCreate doesn't fire
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Let me give it a try, thanks
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
It actually does look like it's firing, but the interaction fails :ThinkEbi: ?
My code is supposed to edit the message of the embed and populate it with different data when the select menu is changed. It works when the bot hasn't been restarted yet but not after it goes offline/comes back online. Do I need to fetch messages from a cache or something?
getProfileEmbed
is returning a message with an embed/a select component depending on the selection madeSorry, forgot to mention that I wanted to use both! Select menu to get some options for the ticket to decide what category it goes in, and then a button to open the ticket.
This actually might be the issue-- I had the listener inside another listener fixed it, thanks so much!