// Create a buttonconstbutton=newutils.Button({ label:"You're right",// text that appears on the button, max 80 characters style:"green",// set the color (green, red, gray, blurple) ID:"my_id"// a developer-defined identifier for the button, max 100 characters})// Let the bot thinkawaitcmd.think()setTimeout(() => {// Response to the interaction with the button after 2.5 secondscmd.reply({ content: `You said you're feeling **${cmd.args.find(e => e.name == "feeling").value}**`, // adding the value of the "feeling" option
components: [button],// add the button ephemeral: cmd.args.find(e => e.name == "ephemeral").value // response as an ephemeral if the user selected "yes"
})},2500)
At the end, it should looks like this
client.on("commandExecuted", cmd => {console.log(cmd)// Create a buttonconstbutton=newutils.Button({ label:"You're right",// text that appears on the button, max 80 characters style:"green",// set the color (green, red, gray, blurple) ID:"my_id"// a developer-defined identifier for the button, max 100 characters })// Response to the interaction with the buttoncmd.callback.post({ content: `You said you're feeling **${cmd.args.find(e => e.name == "feeling").value}**`, // adding the value of the "feeling" option
components: [button],// add the button ephemeral: cmd.args.find(e => e.name == "ephemeral").value // response as an ephemeral if the user selected "yes"
})})
Take a look on the next page, to see how you can receive the event when a user clicks on the button