【发布时间】:2020-09-15 19:29:22
【问题描述】:
我想在我的 discord 机器人上运行一个命令,并为所有具有预定义角色的成员添加一个辅助角色。
它会是这样的。所有具有 X 角色的成员都将被分配到 Y 角色。
我尝试编写代码但失败了,因此我将代码编写为伪代码,任何帮助都会很棒。
const userID = "1234"; //this is my userid so only I will be able to use this command
let roleID1 = "xxxx";
let roleID2 = "yyyy";
client.on("message", function (message) {
if (message.author.id === userID) {
if (message.content === "!setrole") {
// Code for taking the list of all members with role xxxx.
// Code for assigning all those people to the role yyyy.
message.channel.send("Roles assigned");
}
}
});
【问题讨论】:
标签: javascript node.js discord discord.js