我正在为Discord Bot创建一些命令,但是我无法丰富地工作。我正在使用以下内容:
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文件夹中的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);
};
答案 0 :(得分:0)
这是一个老问题,所以我想您已经解决了,但是自从我来到这里,这意味着其他人也可以...
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);
}