我希望我的员工角色可以编辑、删除这个创建的频道。client.on('message', message =>{if (!message.content.startsWith('*open-channel')) return; //This line for some bug happens in my botif (message.channel.id !== '759430340972118026') return; // I set a channel for the users can only use //this command inif(message.author.bot || message.channel.type === "dm") return; //For bugs againif(!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");})如果我写错了,请原谅我的英语不好。:(
1 回答
FFIVE
TA贡献1797条经验 获得超6个赞
你可以使用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'
),
});
添加回答
举报
0/150
提交
取消