【发布时间】:2021-10-05 23:15:44
【问题描述】:
所以我一直在尝试为我的 discord 机器人创建一个命令,我的机器人应该在其中嵌入目标(我提到的人)的名称,但不幸的是,没有任何效果。
bot.on("message", (msg) => {
if (msg.content === "R!kill") {
const embed = new Discord.MessageEmbed();
const yoyoyo = msg.author.username;
const target = msg.mentions.members.first();
embed.setTitle(`**OKAY, LES KILL ${target}**`);
embed.setImage("https://i.redd.it/ijh28d8tw0d11.jpg"), embed.setColor("RANDOM"), embed.setFooter(`mission complete`), msg.channel.send(embed);
}
});
我什至尝试将const target = msg.mentions.members.first(); 更改为const target = msg.mentions.members.first.username();,但仍然无法正常工作。
【问题讨论】:
-
使用 msg.startsWith(...) 代替 msg.content ==
-
你的意思是
msg.content.startsWith()
标签: javascript node.js discord discord.js