How get arguments in slash command?

Registration:
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 загружен')
}
image.png
Was this page helpful?