我正在尝试定义添加的角色并将其添加到嵌入中。 就像,在该命令中添加的角色
在google上查看,什么都没有,在这里查看了相同的结果。
sample flow
在底部显示“警告已发出”的右边,我希望它显示当时添加的角色。
答案 0 :(得分:0)
只要在每个if上返回一个嵌入
if (cmd === `${prefix}warn`) {
var role1 = message.guild.roles.find(role => role.name === "Warning 1");
var role2 = message.guild.roles.find(role => role.name === "Warning 2");
var role3 = message.guild.roles.find(role => role.name === "Warning 3");
if (!message.member.roles.some(r => ["Staff"].includes(r.name)))
return message.reply("ERROR | You do not have sufficient permissions to do this command.");
if (!member)
return message.reply("ERROR | Unable to find the user you mentioned.");
if (!reason)
return message.reply("ERROR | To use this command, you need to specify a reason.");
let sendchannel = message.guild.channels.find(`name`, "action-log");
if (rUser.roles.some(r => ["Warning 2"].includes(r.name))) {
let warnEmbed = new Discord.RichEmbed()
.setColor("#FFD700")
.setDescription("Warn")
.addField("Warned User", `${member}`)
.addField("Warned By", `${message.author}`)
.addField("Reason", `${reason}`)
.addField("Warning issued", `${role3}`)
await rUser.addRole(role3)
return sendchannel.send(warnEmbed);
}
if (rUser.roles.some(r => ["Warning 1"].includes(r.name))) {
let warnEmbed = new Discord.RichEmbed()
.setColor("#FFD700")
.setDescription("Warn")
.addField("Warned User", `${member}`)
.addField("Warned By", `${message.author}`)
.addField("Reason", `${reason}`)
.addField("Warning issued", `${role2}`)
await rUser.addRole(role2)
return sendchannel.send(warnEmbed);
}
if (!rUser.roles.some(r => ["Warning 1"].includes(r.name))) {
let warnEmbed = new Discord.RichEmbed()
.setColor("#FFD700")
.setDescription("Warn")
.addField("Warned User", `${member}`)
.addField("Warned By", `${message.author}`)
.addField("Reason", `${reason}`)
.addField("Warning issued", `${role1}`)
await rUser.addRole(role1)
return sendchannel.send(warnEmbed);
}
}