Executing other commands using buttons

Hello! I'm working on a setup command that shows features (mod logs, welcome channels, autorole on/off, etc) and lets users click a button to setup the selected option. I already have slash commands made for each feature, however, wanted to give users a place to configure everything in one command. My question is- is there a way to have a slash command execute when a button is pressed? I know
command.execute(interaction)
command.execute(interaction)
is a thing, but I'm a little lost on how I'd pass a button press into the execute function properly to run an already existing command.
3 Replies
d.js toolkit
d.js toolkit•4mo 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!
Hanako🌸
Hanako🌸OP•4mo ago
current version of discord.js is 14.12.1 and node is 19.6.0
NyR
NyR•4mo ago
Seperate the logic for it in a different function, and call it in both slash command/button execution
Want results from more Discord servers?
Add your server