首页 > 解决方案 > “ReferenceError:未定义命令”

问题描述

您好,我正在 Visual Studio Code 上制作 Discord 机器人。 我有一个错误出现

ReferenceError:未定义命令。

这是我的代码(对不起,机器人的答案是法语,因为我是。),

我指定我放的代码只是“help.js” 我还有另一个“index.js”文件

const Discord = require('discord.js'),
    config = require('../config.json')

var prefix = ("+");
 
module.exports = {
    run: (message, args, client) => {
            if (args[0]) {
            const command = client.commands.get(args[0].toLowerCase())
            if (!command || !command.help) return message.channel.send('  \' .'), 
             message.channel.send(new Discord.MessageEmbed()
                 .setDescription(`*** : ${command.name}***\n\n${command.help.description}\n\n : \`${config.prefix}${command.name}${command.help.syntax ? ` ${command.help.syntax}` : ''}\``)
                 .setColor('RANDOM'))
        }            
        else if(message.content === prefix + "help"){
            message.channel.send(new Discord.MessageEmbed()
            .setDescription(" __ __**__Voici toutes les commandes disponible grâce au magnifique Pinocchio.__**")
            .setThumbnail('https://i66.servimg.com/u/f66/20/08/95/81/intero10.png')
            .addField("⛏  Modération :", `${command.name}`)
            .addField(`${client.commands.filter(command => command.help).map(command => `\`${config.prefix}${command.name}\``).join(' ')}\n\n  '   ,  \`${config.prefix}ℎ [nom de la commande]\``)
            .addField("  Utilitaires :", "`poll`, `8ball`, `say`, `embed`,")
            .addField("  Musique :", "`BIENTÔT`")
            .setColor("#728cd9")
            .setTimestamp()
            .setFooter('Develop by Tomatee#0010', 'https://cdn.discordapp.com/attachments/853692920737824778/854420356591648778/fifi.jpg+help'))
            }
    },
    name: 'help',
    help: {
        description: '    \'  \'.',
        syntax: '[nom de la commande]'
    }
}

你能帮助我吗? 如果您需要更多信息文件,这是一张照片

标签: javascriptvisual-studio-codereferenceerror

解决方案


推荐阅读