TypeError: Class extends值undefined不是构造函数或null,当尝试使用discord.j



具体问题部分为**module.exports = class HelpCommand extends Command {**

整个help.js文件是(不包括url和东西):

const fs = require('fs');
const { Command } = require('discord.js');
const { MessageEmbed } = require('discord.js');

module.exports = class HelpCommand extends Command {
constructor() {
super('help', {
description: 'List all available commands.',
});
}

async exec(message) {
const help = new MessageEmbed()
.setColor('#F8F7D8')
.setTitle('TITLE')
.setURL('URL')
.setAuthor({
name: 'NAME',
iconURL: 'URL',
url: 'URL',
})
.setDescription('Commands for NAME')
.setThumbnail('URL')
.addFields(
{ name: '/play', value: 'Used to play the music' },
{ name: 'u200B', value: 'u200B' },
{ name: '/pause', value: 'Used to pause the music', inline: true },
{ name: '/mp3', value: 'Used to convert a youtube link to an mp3', inline: true },
{ name: '/skip', value: 'Used to skip the music', inline: true }
)
.setImage('URL')
.setTimestamp()
.setFooter({
text: 'NAME',
iconURL: 'URL',
});

await message.channel.send({ embed: help });
}
};

我试着改变它,但我是新的编码,不知道我在做什么。我使用的是discord.js v14.7.1,并一直试图将我的代码转换为嵌入。该代码是一个斜杠命令,当用户发送/help时将发送嵌入。

您得到的错误是引用损坏或循环引用的标志。在本例中,它是一个破碎的引用。

discord.js不输出任何"Command"所以当你计算const { Command } = require('discord.js');时,它没有定义。我将确保这是您尝试导入的正确位置。

最新更新