Moderation
editChannelPerms
$editChannelPerms
Modifies the permissions of a role or a user on a specific channel using numerical permission values.
Syntax
$editChannelPerms[channelID;roleOrUserID;allow;deny]
$editChannelPerms
The $editChannelPerms[] function modifies the permissions of a role or user on a channel using numerical values (bitfields).
Syntax
$editChannelPerms[channelID;roleOrUserID;allow;deny]
Parameters
| Parameter | Description |
|---|---|
channelID |
The ID of the target channel. |
roleOrUserID |
The ID of the role or the user. |
allow |
Bitfield of permissions to allow (integer). |
deny |
Bitfield of permissions to deny (integer). |
Return value
This function does not return a value.
Behavior
- The bot must have
MANAGE_ROLESorMANAGE_CHANNELSpermission. - Permissions are defined by numerical values:
1024= View channel2048= Send messages4096= Send TTS messages8192= Manage messages16384= Embed links- etc.
Examples
Locking a channel
$editChannelPerms[$channelID;$guildID;0;2048]
$sendMessage[Channel locked: messages disabled for @everyone.]
Unlocking a channel
$editChannelPerms[$channelID;$guildID;2048;0]
$sendMessage[Channel unlocked.]
Private channel by role
$editChannelPerms[$channelID;$guildID;0;1024]
$editChannelPerms[$channelID;$vipRoleID;1024;0]
$sendMessage[Channel made private for the VIP role.]
Notes
- The
allowanddenypermissions are sums of flags. Add the values together to combine permissions. $guildIDrepresents the @everyone role.- For a more readable approach, use
$modifyChannelPerms[].