client.on('ready', () => {
command(client, 'createcategory', (message) => {
const name = message.content.replace('!createcategory ', '')
if(message.guild.channels.cache.find(c => c.name == message.author.username && c.type == "category") === undefined){
message.guild.channels.create(message.author.username, {type: 'category', permissionOverwrites: [
{
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
},
{
id: message.author.id,
allow: ['VIEW_CHANNEL'],
},
]})
message.guild.channels.create('Text channel', {type: 'text', permissionOverwrites: [
{
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
},
{
id: message.author.id,
allow: ['VIEW_CHANNEL'],
},
]}).then(channel => {
let category = message.guild.channels.cache.find(c => c.name == message.author.username && c.type == "category");
if (!category) throw new Error("Category channel does not exist");
channel.setParent(category.id);
}).catch(console.error);
message.guild.channels.create('Voice channel', {type: 'voice', permissionOverwrites: [
{
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
},
{
id: message.author.id,
allow: ['VIEW_CHANNEL'],
},
]}).then(channel => {
let category = message.guild.channels.cache.find(c => c.name == message.author.username && c.type == "category");
if (!category) throw new Error("Category channel does not exist");
channel.setParent(category.id);
}).catch(console.error);
} else {message.send('Jau tu turi kanala, kurviuk tu')}
});
});
代码曾经有效,但不知何故我忘记了我用它做了什么并且没有编码 2 个月左右......功能应该是 - 当你编写它时应该!createcategory创建一个包含语音和文本通道的类别。该类别应以您的用户名命名。控制台没有错误,请帮忙,谢谢!
慕尼黑的夜晚无繁华
相关分类