Re-run bot command

I'm creating a bot that has multiple steps that a user navigates using buttons. I have a "back" button that I would like to trigger a restart, as if the user had abandoned the current bot session and entered the slash command to run the bot again. Is there a way to do this? I've tried interaction.client.commands.get('command').execute(); and it fires but it seems that there's no interaction object when it runs. I would like it to create a whole new slash command interaction. Does anyone know how I can achieve this?
3 Replies
d.js toolkit
d.js toolkit17mo 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!
treble/luna
treble/luna17mo ago
you cant. bots cannot trigger slash commands you can pass in a buttoninteraction and then edit your code to work with buttons as well as slash commands
h3rm3s
h3rm3sOP17mo ago
Yeah, that could work too. I've been trying different methods because I'm having difficulty getting the exact behavior I want and I'm not sure why, so I figured a fresh restart might be a good way to do it The bot is kind of complicated and there are various steps the user can navigate through via the buttons, so it's been tough to achieve functionality where the message is being updated or edited numerous times to reflect the state of the bot, without it crashing lol Thanks for your help
Want results from more Discord servers?
Add your server