Bots discord.js富嵌入命令处理程序
我正在为我的Discord机器人创建一些命令,但我无法工作。我正在使用以下命令:Bots discord.js富嵌入命令处理程序,bots,embed,discord,Bots,Embed,Discord,我正在为我的Discord机器人创建一些命令,但我无法工作。我正在使用以下命令: exports.run = (client, message, args) => { const embed = new Discord.RichEmbed() .setTitle("Bulbasaur") .setColor("#43A6DF") .setDescription("Seed Pokémon") .setThumbnail("image.png") .
exports.run = (client, message, args) => {
const embed = new Discord.RichEmbed()
.setTitle("Bulbasaur")
.setColor("#43A6DF")
.setDescription("Seed Pokémon")
.setThumbnail("image.png")
.setURL("URL")
.addField("Type", "Grass, Poison")
.addField("Abilities", "Overgrow, Chlorophyll*")
.addField("Pokédex", "Link")
message.channel.send("{embed}").catch(console.error);
}
如果我简单地使用这个,我就没有问题了:
exports.run = (client, message, args) => {
message.channel.send("pong!").catch(console.error);
}
我做错了什么?这是events文件夹中的my message.js文件:
// Ignore all bots
if (message.author.bot) return;
// Ignore messages not starting with the prefix (in config.json)
if (message.content.indexOf(client.config.prefix) !== 0) return;
// Our standard argument/command name definition.
const args = message.content.slice(client.config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
// Grab the command data from the client.commands Enmap
const cmd = client.commands.get(command);
// If that command doesn't exist, silently exit and do nothing
if (!cmd) return;
// Run the command
cmd.run(client, message, args);
};
这是一个老问题,所以我想你已经解决了,但自从我来到这里,这意味着其他人也可以
exports.run = (client, message, args) => {
const embed = new Discord.RichEmbed()
.setTitle("Bulbasaur")
.setColor("#43A6DF")
.setDescription("Seed Pokémon")
.setThumbnail("image.png")
.setURL("URL")
.addField("Type", "Grass, Poison")
.addField("Abilities", "Overgrow, Chlorophyll*")
.addField("Pokédex", "Link");
message.channel.send({embed}).catch(console.error);
}