Discord.js Discord js创建Discord类别
我正在尝试使用discord Bot在discord服务器上创建一个类别,但在internet上找不到该方法或其他内容。我还查看了“discord.js.org”。然后我想那是不可能的。那么,有没有办法在discord服务器上创建一个类别?您需要使用Discord.js Discord js创建Discord类别,discord.js,Discord.js,我正在尝试使用discord Bot在discord服务器上创建一个类别,但在internet上找不到该方法或其他内容。我还查看了“discord.js.org”。然后我想那是不可能的。那么,有没有办法在discord服务器上创建一个类别?您需要使用.createChannel方法,然后输入“category”作为频道类型 <guild>.createChannel("NAME OF THE CHANNEL", "category") .createChannel(“频道名称”、“
.createChannel
方法,然后输入“category”作为频道类型
<guild>.createChannel("NAME OF THE CHANNEL", "category")
.createChannel(“频道名称”、“类别”)
您需要使用.createChannel
方法,然后输入“类别”作为频道类型
<guild>.createChannel("NAME OF THE CHANNEL", "category")
.createChannel(“频道名称”、“类别”)
我建议使用promise,因为它为您的代码增加了很多功能和安全性
guild.createChannel('new-category', {
type: 'category',
permissionsOverwrites: [{
id: guild.id,
deny: ['MANAGE_MESSAGES'],
allow: ['SEND_MESSAGES']
}]
})
.then(console.log)
.catch(console.error);
这允许您创建具有权限的频道,并实际处理任何错误,如频道已存在或您的机器人无法创建所述频道,原因是其分配了权限
这是正确的方法
创建通道的示例
guild.createChannel('new-general', { type: 'text' })
.then(console.log)
.catch(console.error);
我建议使用promise,因为它为代码增加了很多功能和安全性
guild.createChannel('new-category', {
type: 'category',
permissionsOverwrites: [{
id: guild.id,
deny: ['MANAGE_MESSAGES'],
allow: ['SEND_MESSAGES']
}]
})
.then(console.log)
.catch(console.error);
这允许您创建具有权限的频道,并实际处理任何错误,如频道已存在或您的机器人无法创建所述频道,原因是其分配了权限
这是正确的方法
创建通道的示例
guild.createChannel('new-general', { type: 'text' })
.then(console.log)
.catch(console.error);
v12:
message.guild.channels.create('Category',{type:'Category'});
v12:
message.guild.channels.create('Category',{type:'Category'});
我为您制作了一个命令代码。请修改并使用它
if(message.content === `${prefix}create-channel`) {
message.guild.createChannel('name', {
//Channel type (text || voice || category)
type: 'text',
permissionsOverwrites: [{
id: guild.id,
deny: [],
allow: ['SEND_MESSAGES']
}]
})
.catch(console.error);
}
我已经为您制作了一个命令代码。请修改并使用它
if(message.content === `${prefix}create-channel`) {
message.guild.createChannel('name', {
//Channel type (text || voice || category)
type: 'text',
permissionsOverwrites: [{
id: guild.id,
deny: [],
allow: ['SEND_MESSAGES']
}]
})
.catch(console.error);
}