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');
},
};
这是我的代码。我不知道为什么它一直说它不是一个构造函数,我按照discordjs指南做了一切正确的事情。不过我用的是v13版本,这会有什么区别吗?
我将SlashCommandBuilder的B大写了,但仍然不起作用。我不知道为什么。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
确保部署您的命令。在discord.js指南中,有一个免费的脚本可以完成这个任务。如果您没有部署您的命令(或者部署不正确),它们将不会显示在您的服务器的命令列表中。