removeChannel

Removes a specified channel from the current server.

Syntax

removeChannel(channelID)

Parameters

  • channelID : The channel to be removed. Value must be a valid channel snowflake ID.

Permissions

Required permission which the bot must have for this function to work properly:

  • managechannels

Example

try {
  const msg = message.replace(commandPrefix, '').trim().split(' ');

  if (!msg[0]) {
    setResponse(`Usage : \` ${commandPrefix} [#channel] \``);
  } else {
    const isChannel = /^<#!?(\d{17,20})>$/.test(msg[0]);

    if (!isChannel)
      throw new Error('Mention a valid channel!');

    const channelID = msg[0].match(/\d/g).join('');

    sendChannelMessage(channelId, `Channel <#${channelID}> has been deleted!`);

    removeChannel(channelID);
  };
} catch (err) {
  setResponse('Command Error : ` ' + err.message + ' `');
};

Screenshot_20220919_171553
InShot_20220919_171824516