How get arguments in slash command?
Registration:
Command:
const data = new SlashCommandBuilder()
.setName('balance')
.setDescription('Просмотр баланса')
.addUserOption(option => option.setName('user') .setDescription('Просмотр баланса другого пользователя'))
await bot.application.commands.create(data).catch(console.error);const data = new SlashCommandBuilder()
.setName('balance')
.setDescription('Просмотр баланса')
.addUserOption(option => option.setName('user') .setDescription('Просмотр баланса другого пользователя'))
await bot.application.commands.create(data).catch(console.error);Command:
const { Events } = require('discord.js');
module.exports = function balance(bot) {
bot.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
console.log(???) // ARGUMENTS (user ID)
if (interaction.commandName === 'balance') {
await interaction.reply({embeds: [{title: 'Test', description: 'Testing', color: 0x00ff00, thumbnail: {url: bot.user.displayAvatarURL()}}]});
};
});
console.log('Ког balance загружен')
}const { Events } = require('discord.js');
module.exports = function balance(bot) {
bot.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isChatInputCommand()) return;
console.log(???) // ARGUMENTS (user ID)
if (interaction.commandName === 'balance') {
await interaction.reply({embeds: [{title: 'Test', description: 'Testing', color: 0x00ff00, thumbnail: {url: bot.user.displayAvatarURL()}}]});
};
});
console.log('Ког balance загружен')
}