Good day,
I would like to save the content that you type in addStringOption, I just don't know how to query that, can someone explain it to me?
const { SlashCommandBuilder } = require("@discordjs/builders");
module.exports = {
data: new SlashCommandBuilder()
.setName('announce')
.setDescription('test')
.addSubcommand(subcommand =>subcommand.setName('normal').setDescription('TEST')
.addStringOption(option => option.setName('message').setDescription('TEST').setRequired(true))),
async execute(interaction) {
interaction.reply("test")
}
}
I am not 100% what you mean by query but I assume you want to get the value of the option they user has entered. For this you want to use the getString function on the options property.
async execute(interaction) {
// Get the string option
const value = interaction.options.getString('message');
// Return the value
await interaction.reply(value);
}
Read More Here: https://discord.js.org/#/docs/discord.js/stable/class/CommandInteractionOptionResolver?scrollTo=getString