所以我有一个带有静音命令的不和谐机器人,但是它没有用。我认为正是角色的位置使静音被成员角色所取代,所以我决定将其设置为机器人角色的正下方,但我不知道该怎么做,最终我打破了整个脚本。有人可以让我知道我做错了什么以及如何使用这种方法吗?
let botrolelevel = message.guild.roles.find(x => x.name === "mod bott").position;
let givenposition = botrolelevel -1;
if(!reason) reason = "No reason provided";
if (!role){
try{
role = await message.guild.createRole({
name: "Muted",
color: "#FFFFFF",
permissions:[],
position: givenposition
})
message.guild.channels.forEach(async (channel, id) => {
message.channel.overwritePermission(role, {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
SEND_TTS_MESSAGES: false,
ATTACH_FILES: false,
SPEAK: false
});
});
}catch(e){
console.log(e);
}
}