Create a category and a channel in the category

I try to create a Category and a channel in it, somehow it dont accept the category as a parent
static async createAndRegisterVCGenerator(guild: Guild): Promise<VoiceChannel> {
const cat = await guild.channels.create((options: GuildChannelCreateOptions) => {
options.name = '-= Voice Channels =-';
options.type = ChannelType.GuildCategory
});
const channel = await guild.channels.create((options: GuildChannelCreateOptions) => {
options.name = '🔈 Create a VC';
options.type = ChannelType.GuildVoice;
options.parent = cat;
});
return channel;
}
static async createAndRegisterVCGenerator(guild: Guild): Promise<VoiceChannel> {
const cat = await guild.channels.create((options: GuildChannelCreateOptions) => {
options.name = '-= Voice Channels =-';
options.type = ChannelType.GuildCategory
});
const channel = await guild.channels.create((options: GuildChannelCreateOptions) => {
options.name = '🔈 Create a VC';
options.type = ChannelType.GuildVoice;
options.parent = cat;
});
return channel;
}
No description
Solution:
Review the documentation provided by DiscordJS. Your syntax is wrong. https://discord.js.org/docs/packages/discord.js/14.14.1/GuildChannelManager:Class#create
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Jump to solution
2 Replies
Solution
Favna
Favna•9mo ago
Review the documentation provided by DiscordJS. Your syntax is wrong. https://discord.js.org/docs/packages/discord.js/14.14.1/GuildChannelManager:Class#create
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Fabi
FabiOP•9mo ago
oh well, i just its like that.. thanks!
Want results from more Discord servers?
Add your server