-
Notifications
You must be signed in to change notification settings - Fork 237
Overwrite
SQKo edited this page Dec 9, 2023
·
3 revisions
Overwrites are part of Channel. Also known as "Channel Permissions" in Discord.
use Discord\Parts\Channel\Overwrite;
You must first get the Channel object to use the code below. Change 123123123123123123
below with the User ID or Role ID
Cached, synchronous:
$overwrite = $channel->overwrites->get('id', '123123123123123123');
Your BOT must have manage_roles
permission
You must first get the Channel object and the Member object to use the code below
Set $member
permission in the $channel
to allow send messages, attach files, but deny add reaction:
$allow = new ChannelPermission($discord, [
'send_messages' => true,
'attach_files' => true,
]);
$deny = new ChannelPermission($discord, [
'add_reactions' => true,
]);
$overwrite = $channel->overwrites->create([
'allow' => $allow,
'deny' => $deny,
]);
// Member can send messages and attach files,
// but can't add reactions to message.
$channel->setOverwrite($member, $overwrite)->then(function () {
// ...
})->done();
https://discord.com/developers/docs/resources/channel#edit-channel-permissions
Note: This wiki is currently Work In Progress. Consider reading the docs instead.
- Application Command (Slash based)
Command Client (Message based)
- Activity
- Application
- Guild
- Private Channel
- User
Components
-
ActionRow
- Buttons
- Option (commands)
- SelectMenu
- TextInput
Builders