我正在尝试让机器人扮演角色并在命令的参数中转到指定的频道。
该代码将使机器人进入指定的频道,并为机器人刚刚创建的角色添加权限,这就是问题所在。
VSC 中的控制台说“未指定角色/用户”并跳过它。
我尝试将 更改arole
为 var,并将arole
( message.arole
) 设置为arole.id
,但它仍然不起作用。乱搞和更改设置根本不起作用。
let woaID = message.mentions.channels.first();
if (!woaID) return message.channel.send("Channel is nonexistant or command was not formatted properly. Please do s!woa #(channelname)");
let specifiedchannel = message.guild.channels.find(t => t.id == woaID.id);
var arole = message.guild.createRole({
name: `A marker v1.0`,
color: 0xcc3b3b,
hoist: false,
mentionable: false,
permissions: ['SEND_MESSAGES']
}).catch(console.error);
message.channel.send("Created role...");
message.channel.send("Role set up...");
/*const sbwrID = message.guild.roles.find(`null v1.0`);
let specifiedrole = message.guild.roles.find(r => r.id == sbwrID.id)*/
message.channel.send('Modified');
specifiedchannel.overwritePermissions(message.arole, {
VIEW_CHANNEL: true,
SEND_MESSAGES: false
})
.then(updated => console.log(updated.permissionOverwrites.get(arole.id)))
.catch(console.error);
我希望机器人能够访问 args 中的指定频道,并为该频道创建角色并覆盖角色权限。
实际输出是 bot 一切正常,但角色没有通道的特殊权限。