// Check if this Channel where the command was used belongs to a Category
if (interaction.channel.parent) {
// If the Channel where the command was used belongs to a Category,
// create another Channel in the same Category.
await interaction.channel.parent.guild.channels.create
name: chosenVoiceChannelName, // The name given to the Channel by the user
type: ChannelType.GuildVoice, // The type of the Channel created.
});
// If we managed to create the Channel, edit the initial response with
// a success message
await interaction.editReply({
content:
"Your voice channel was successfully created in the same category!",
});
return;
}
// Check if this Channel where the command was used belongs to a Category
if (interaction.channel.parent) {
// If the Channel where the command was used belongs to a Category,
// create another Channel in the same Category.
await interaction.channel.parent.guild.channels.create
name: chosenVoiceChannelName, // The name given to the Channel by the user
type: ChannelType.GuildVoice, // The type of the Channel created.
});
// If we managed to create the Channel, edit the initial response with
// a success message
await interaction.editReply({
content:
"Your voice channel was successfully created in the same category!",
});
return;
}