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粉4587250402023-09-07 14:18:15
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.