This snippet allows you to create a channel with a custom name and description. All you have to do to set this up is to go to the Autocode Slash Command Builder and register "createchannel" slash command with 2 string variables. First one should be name, second one should be the channel description.
// authenticates you with the API standard library
// type `await lib.` to display API autocomplete
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let isMANAGE_CHANNELS =
(context.params.event.member.permissions & (1 << 4)) === 1 << 4;
if (isMANAGE_CHANNELS) {
let name = context.params.event.data.options[0].value;
let topic = context.params.event.data.options[1].value;
let result = await lib.discord.guilds['@0.1.0'].channels.create({
guild_id: `${context.params.event.guild_id}`,
name: `${name}`,
topic: `${topic}`,
});
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `**<@${context.params.event.member.user.id}> - channel successfully created!**`,
});
} else {
await lib.discord.channels['@0.2.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `**<@${context.params.event.member.user.id}> - You need the MANAGE_CHANNELS permission to use this command**`,
});
}