【发布时间】:2020-10-05 01:06:42
【问题描述】:
我想用 discord.js-commando 发送嵌入,但是当我发送命令时它告诉我:
运行命令时出错:TypeError: RichEmbed is not a constructor 你不应该收到这样的错误。
这是我的代码
const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
module.exports = class EmbedCommand extends Command {
constructor(client) {
super(client, {
name: 'embed',
group: 'util',
memberName: 'embed',
description: 'Embeds the text you provide.',
examples: ['embed Embeds are cool.'],
args: [
{
key: 'text',
prompt: 'What text would you like the bot to embed?',
type: 'string'
}
]
});
}
run(msg, args) {
const { text } = args;
const embed = new RichEmbed()
.setDescription(text)
.setAuthor(msg.author.username, msg.author.displayAvatarURL)
.setColor(0x00AE86)
.setTimestamp();
return msg.embed(embed);
}
};
【问题讨论】:
标签: discord.js