标题重写为:SlashCommandBuilder并非构造函数的实例化方式
P粉588660399
P粉588660399 2023-09-06 17:48:31
0
1
404

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大写了,但仍然不起作用。我不知道为什么。

P粉588660399
P粉588660399

全部回复(1)
P粉458725040

确保部署您的命令。在discord.js指南中,有一个免费的脚本可以完成这个任务。如果您没有部署您的命令(或者部署不正确),它们将不会显示在您的服务器的命令列表中。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!