This snippet will help you rename a channel where you triggered the command. use .rename new-name to update the channel name! Ensure that your bot has MANAGE_CHANNELS permission.
/*
* Usage:
* Go to the channel that you want to be renamed
* Enter in following format:
*
* Example: .rename new-channel-name
*/
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const newChannelName = context.params.event.content
.split(' ')
.slice(1)
.join(' ')
?.replace(/ /g, '-');
const REF_CHANNEL_ID = context.params.event.channel_id;
await lib.discord.channels['@0.3.2'].update({
channel_id: REF_CHANNEL_ID,
name: newChannelName,
});