Skip to content
Moderation modifyChannel

$modifyChannel

The function $modifyChannel allows you to modify the properties of an existing channel.

Syntax

$modifyChannel[channelID;(name);(topic);(nsfw);(position);(categoryID);(reason)]

Parameters

Parameter Description
channelID Required. The ID of the channel to modify (a positive integer, otherwise an error is raised).
name Optional - The new name (trimmed, 1 to 100 characters). Empty keeps the current name.
topic Optional - The new topic (max 1024 characters, 4096 for a forum). Empty keeps the current topic; !clear removes it.
nsfw Optional - yes/no (or true/false, case-insensitive) for NSFW status. Empty keeps the current value; any other value raises NSFW must be yes or no.
position Optional - The new position of the channel, as a positive integer starting at 1 (Channel position must be a positive integer. otherwise). Empty keeps the current position.
categoryID Optional - The ID of the new parent category (must be a category of the same server). Empty keeps the current category.
reason Optional. Reason recorded in the server’s audit log (up to 512 characters). Empty, or absent, uses the reason set with $auditLogReason, if any.

Return Value

This function does not return any value.

Behavior

  • The bot must have Manage Channels in the channel (effective permissions, channel overwrites included), plus Connect for a voice or stage channel and Manage Threads for a thread; otherwise an error is raised.
  • The topic is only supported by text, announcement and forum channels; NSFW is not supported by categories; for a thread only the name can be changed (topic, NSFW, position and category raise an error).
  • If every parameter is left unchanged, no request is sent to Discord.
  • Optional parameters can be left empty (or set to !unchanged) to keep their current value. This includes topic: $modifyChannel[$channelID;;;yes] changes only the NSFW status and does not touch the topic (even on a voice channel, which has none). To remove the topic, write !clear.
  • The parameter order is important — use empty semicolons ; to skip parameters.
  • There is no slowmode parameter.

Examples

Renaming a channel

$modifyChannel[$channelID;archives-$date]
$sendMessage[Channel renamed.]

Clearing the topic

$modifyChannel[$channelID;;!clear]
$sendMessage[Topic removed.]

Changing the NSFW status

$modifyChannel[$channelID;;;no]
$sendMessage[Channel is no longer NSFW.]

Moving to a category

$modifyChannel[$channelID;;;;;123456789]
$sendMessage[Channel moved.]

Modifying all properties

$modifyChannel[$channelID;rules;Server Rules - updated on $date;no;1;123456789]
$sendMessage[Channel updated successfully.]

Notes

  • Use empty parameters (;) to skip options you do not want to modify.
  • Channel names must follow the same rules as in $createChannel[].
  • To modify channel permissions, use $modifyChannelPerms[].

Audit log reason

The last, optional argument reason is the reason shown next to this action in the server’s audit log (Discord’s X-Audit-Log-Reason). Without it, the reason set earlier in the script with $auditLogReason is used; with neither, no reason is recorded.

Try it

Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.