Reputation: 53
What I want the command to do is to say what we want the bot to say.
Example : /echo Testing
and the bot should respond : Testing
But I can't figure out how to do it
Here is my code :
const { SlashCommandBuilder, SlashCommandStringOption } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('echo')
.setDescription('Replies with your input!')
.addStringOption(option =>
option.setName('input')
.setDescription('The input to echo back')
.setRequired(true)),
async execute(interaction) {
await interaction.send(input)
},
};
Upvotes: 0
Views: 2976
Reputation: 9041
You have to use the CommandInteraction.options
and use .getString()
on that to get the input
async execute(interaction) {
const input = interaction.options.getString("input")
await interaction.reply(input)
}
Upvotes: 3