SlashCommandBuilder is not a constuctor

81 Views Asked by At
const { SlashCommandBuilder} = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('smurf')
        .setDescription('Show time until smurf. 5 Minute warning will be executed as well.')
        .addStringOption(option =>
            option
                .setName('points')
                .setDescription('Points to win. Ex: 145,000')
                .setRequired(true))
        .addStringOption(option =>
            option
                .setName('current-score')
                .setDescription('Current score. Ex: 50,000')
        .setRequired(true))
  .addStringOption(option =>
            option
                .setName('point-gain')
                .setDescription('Point gain. Ex: 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');

    },
};

That's my code. I don't know why it keeps saying it's not a constuctor when I did everything right (according to the discordjs guide) I'm on v13 though. Would that make a difference?

I made SlashCommandBuilder an uppercase B and it still didn't work. I don't know why.

1

There are 1 best solutions below

2
sticks On

Make sure you deploy your commands. On the discord.js guide, there's a free script which will do that. If you haven't deployed your commands (or you've deployed them incorrectly), they won't show up in your server's command list.