Title rewritten as: SlashCommandBuilder is not a constructor method of instantiation
P粉588660399
P粉588660399 2023-09-06 17:48:31
0
1
432

const { SlashCommandBuilder} = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('smurf')
        .setDescription('展示距离smurf的时间。同时还会执行5分钟的警告。')
        .addStringOption(option =>
            option
                .setName('points')
                .setDescription('获胜的点数。例如:145,000')
                .setRequired(true))
        .addStringOption(option =>
            option
                .setName('current-score')
                .setDescription('当前得分。例如:50,000')
        .setRequired(true))
  .addStringOption(option =>
            option
                .setName('point-gain')
                .setDescription('点数增益。例如:30')
        .setRequired(true))
};

module.exports = {
    async execute(interaction) {
        const points = interaction.options.getString('points');
        const cScore = interaction.options.getString('current-score');
    const pGain = interaction.options.getString('point-gain');

    },
};

This is my code. I don't know why it keeps saying it's not a constructor, I followed the discordjs guide and did everything right. But I am using version v13, will this make any difference?

I capitalized the B in SlashCommandBuilder, but it still doesn't work. I do not know why.

P粉588660399
P粉588660399

reply all(1)
P粉458725040

Make sure to deploy your command. In the discord.js guide, there is a free script that does the job. If you do not deploy your commands (or deploy them incorrectly), they will not appear in your server's command list.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!