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.
const { cmd } = require("syntx.js");
await cmd.channel.edit({ channel, data, permissions }, message);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | Channel | Yes | The channel ID or a discord.js channel object to edit. |
data | object | No | Fields to update. See data fields below. |
permissions | PermissionEntry[] | No | Permission overwrites to apply or update. See permissions below. |
message | discord.js Message | Yes | A guild message or interaction, used to access the guild. |
Data fields
| Field | Type | Channel types | Description |
|---|---|---|---|
name | string | All | New name for the channel. |
topic | string | All | New topic or description. |
nsfw | boolean | All | Whether the channel is age-restricted. |
cooldown | number | Text, announcement, forum, voice, stage | Slowmode duration in seconds. |
category | string | All | ID of the new parent category. |
position | number | All | New position in the sidebar. |
bitrate | number | Voice, stage | Audio bitrate in bits per second. |
userLimit | number | Voice only | Maximum number of users allowed in the voice channel. |
rtcRegion | string | Voice, stage | Voice region override. Pass null to set to automatic. |
autoArchiveDuration | number | All (affects thread defaults) | Default auto-archive duration for threads (in minutes). |
availableTags | object[] | Forum only | List of available tags for the forum channel. |
reason | string | All | Audit 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:
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The user or role ID to target. Use "everyone" for @everyone. |
type | string | Yes | Either "user" or "role". |
permissions | object | Yes | A 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
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
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
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.