我可以设置我创建的频道权限,比如只有我的员工角色可以编辑或删除它吗?到目前为止我的代码:

我希望我的员工角色可以编辑、删除这个创建的频道。


client.on('message', message =>{

if (!message.content.startsWith('*open-channel')) return;  //This line for some bug happens in my bot

if (message.channel.id !== '759430340972118026') return;   // I set a channel for the users can only use 

                                                           //this command in

if(message.author.bot || message.channel.type === "dm") return; //For bugs again

if(!message.member.roles.cache.some(role => role.name === 'OWNER')) {               //This command only 

                                                                                    //for owner role now.

      return message.reply('You should be OWNER for using this command.').then(message => {

message.delete({ timeout: 8000 })

})

}

  const messageArray = message.content.split(' ');

const cmd = messageArray[0];

const args = messageArray.slice(1).join(' ').toUpperCase();

  if (message.content.startsWith('*open-channel'))

var kanal = message.guild.channels.create(`${args} - ${message.author.tag}`,{type : 'voice'})

.then(channel => channel.setParent(message.guild.channels.cache.find(channel => channel.name === "USER CHANNELS"))); //setParent moves my channel to choosen catagory. And 'args - message.author.tag'  is channel name

                                                          

  message.channel.send("Its done now buddy :3");


})

如果我写错了,请原谅我的英语不好。:(


喵喵时光机
浏览 95回答 1
1回答

FFIVE

你可以使用GuildChannelManager.create.options.permissionOverwrites()。另外,您可以在创建通道时直接设置通道父级。message.guild.channels.create(`${args} - ${message.author.tag}`, { type: 'voice', permissionOverwrites: [  {   id: '<Staff Role ID>',   allow: ['MANAGE_CHANNELS'],  }, ], parent: message.guild.channels.cache.find(  (channel) => channel.name === 'USER CHANNELS' ),});
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript