我需要创建一个命令,首先从所有以星号开头的角色中删除该成员,然后分配一个将在命令参数中传递的角色。
exports.run = (client, message, [where]) => {
var role = message.guild.roles.cache.find(role => role.name === where);
if (role && where.substring(0, 1) == '*') {
//remove all roles that start with * from the member, probably some kind of for loop?
message.member.roles.add(role);
message.channel.send(message.member.nickname + ' entered the channel ' + where + '.');
}
else message.channel.send('Channel' + where + ' does not exist or does not start with *.');
};
你能帮我解决那个for循环吗?谢谢。
慕莱坞森
相关分类