我有一个代码,如果我通过给一个没有权限的角色使一个提及的人静音,那么我就无法分配该角色
这是代码
try{
muterole = message.guild.roles.create({
data: {
name: 'muted',
color: 'BLUE',
permissions:[0]
}
})
}catch(err){
console.log(err);
message.channel.send("An error occured logs were sent to the dev")
}
message.mentions.members.first().roles.add(muterole.id);
任何帮助都非常感谢:)
答案 0 :(得分:0)
message.guild.roles.create({
data: {
name: "Muted",
color: "BLUE",
permissions: []
}
}).then(role => {
message.mentions.members.first().roles.add(role).catch(error => {message.channel.send("Couldn't add the role."); console.error(error)});
}).catch(error => {message.channel.send("An error occured, logs were sent to the developer."); console.error(error)});