cmd.channel.edit

Edits an existing channel in the guild. Supports updating metadata such as name, topic, and slowmode, as well as modifying permission overwrites. Only the fields you provide are changed; everything else stays as-is.

JavaScript
const { cmd } = require("syntx.js");

await cmd.channel.edit({ channel, data, permissions }, message);

Parameters

ParameterTypeRequiredDescription
channelstring | ChannelYesThe channel ID or a discord.js channel object to edit.
dataobjectNoFields to update. See data fields below.
permissionsPermissionEntry[]NoPermission overwrites to apply or update. See permissions below.
messagediscord.js MessageYesA guild message or interaction, used to access the guild.

Data fields

FieldTypeChannel typesDescription
namestringAllNew name for the channel.
topicstringAllNew topic or description.
nsfwbooleanAllWhether the channel is age-restricted.
cooldownnumberText, announcement, forum, voice, stageSlowmode duration in seconds.
categorystringAllID of the new parent category.
positionnumberAllNew position in the sidebar.
bitratenumberVoice, stageAudio bitrate in bits per second.
userLimitnumberVoice onlyMaximum number of users allowed in the voice channel.
rtcRegionstringVoice, stageVoice region override. Pass null to set to automatic.
autoArchiveDurationnumberAll (affects thread defaults)Default auto-archive duration for threads (in minutes).
availableTagsobject[]Forum onlyList of available tags for the forum channel.
reasonstringAllAudit log reason for the edit.

Warning

Passing a field that is incompatible with the channel type (for example, userLimit on a text channel) will throw a SyntxError before any edit is attempted.

Permissions

Permission overwrites are merged with existing ones, not replaced entirely. Each entry in the array uses the same shape as cmd.channel.create:

FieldTypeRequiredDescription
idstringYesThe user or role ID to target. Use "everyone" for @everyone.
typestringYesEither "user" or "role".
permissionsobjectYesA map of Discord permission names to true (allow), false (deny), or null (neutral/reset).

Setting a permission to null removes it from both the allow and deny lists, effectively resetting it to the inherited value.

Returns

The updated discord.js Channel object.

Examples

Rename a channel and set a new topic

JavaScript
client.command({
  name: "editchannel",
  content: async (message) => {
    const channelId = cmd.channel.mentioned(message, 1);
    if (!channelId) return message.reply("Please mention a channel.");

    const updated = await cmd.channel.edit(
      {
        channel: channelId,
        data: {
          name: "announcements",
          topic: "Official server announcements",
          reason: "Channel reorganization",
        },
      },
      message
    );

    message.reply(`Channel updated: <#${updated.id}>`);
  },
});

Update voice channel settings

JavaScript
client.command({
  name: "editvoice",
  content: async (message) => {
    await cmd.channel.edit(
      {
        channel: "VOICE_CHANNEL_ID",
        data: {
          userLimit: 10,
          bitrate: 96000,
          rtcRegion: "us-east",
        },
      },
      message
    );

    message.reply("Voice channel updated.");
  },
});

Update permission overwrites

JavaScript
client.command({
  name: "lockdown",
  content: async (message) => {
    await cmd.channel.edit(
      {
        channel: message.channel,
        permissions: [
          {
            id: "everyone",
            type: "role",
            permissions: {
              SEND_MESSAGES: false,
            },
          },
        ],
        data: {
          reason: "Channel locked for maintenance",
        },
      },
      message
    );

    message.reply("Channel locked.");
  },
});

Warning

The bot must have the Manage Channels permission for the target channel. If it is missing, a SyntxError is thrown.