DiscordPHP Documentation

ChannelPermission extends Permission
in package

Represents a set of permissions for a given channel overwrite.

Tags
since
2.1.3

Table of Contents

Constants

ADD_REACTIONS  = 6
Allows for adding new reactions to messages. This permission does not apply to reacting with an existing reaction on a message.
ADMINISTRATOR  = 3
Allows all permissions and bypasses channel permission overwrites.
ALL_PERMISSIONS  = ['create_instant_invite' => self::CREATE_INSTANT_INVITE, 'manage_channels' => self::MANAGE_CHANNELS, 'add_reactions' => self::ADD_REACTIONS, 'view_channel' => self::VIEW_CHANNEL, 'send_messages' => self::SEND_MESSAGES, 'send_tts_messages' => self::SEND_TTS_MESSAGES, 'manage_messages' => self::MANAGE_MESSAGES, 'embed_links' => self::EMBED_LINKS, 'attach_files' => self::ATTACH_FILES, 'read_message_history' => self::READ_MESSAGE_HISTORY, 'mention_everyone' => self::MENTION_EVERYONE, 'use_external_emojis' => self::USE_EXTERNAL_EMOJIS, 'manage_roles' => self::MANAGE_ROLES, 'manage_webhooks' => self::MANAGE_WEBHOOKS, 'use_application_commands' => self::USE_APPLICATION_COMMANDS, 'use_external_stickers' => self::USE_EXTERNAL_STICKERS, 'send_voice_messages' => self::SEND_VOICE_MESSAGES]
Array of permissions for all roles.
ATTACH_FILES  = 15
Allows for uploading images and files.
BAN_MEMBERS  = 2
Allows banning members.
CHANGE_NICKNAME  = 26
Allows for modification of own nickname.
CONNECT  = 20
Allows for joining of a voice channel.
CREATE_EVENTS  = 44
Allows for creating scheduled events, and editing and deleting those created by the current user. Not yet available to developers.
CREATE_GUILD_EXPRESSIONS  = 43
Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user. Not yet available to developers.
CREATE_INSTANT_INVITE  = 0
Allows creation of instant invites.
CREATE_PRIVATE_THREADS  = 36
Allows for creating private threads.
CREATE_PUBLIC_THREADS  = 35
Allows for creating public and announcement threads.
DEAFEN_MEMBERS  = 23
Allows for deafening of members in a voice channel.
EMBED_LINKS  = 14
Links sent by users with this permission will be auto-embedded.
KICK_MEMBERS  = 1
Allows kicking members.
MANAGE_CHANNELS  = 4
Allows management and editing of channels.
MANAGE_EVENTS  = 33
Allows for editing and deleting scheduled events created by all users.
MANAGE_GUILD  = 5
Allows management and editing of the guild.
MANAGE_GUILD_EXPRESSIONS  = 30
Allows for editing and deleting emojis, stickers, and soundboard sounds created by all users.
MANAGE_MESSAGES  = 13
Allows for deletion of other users messages.
MANAGE_NICKNAMES  = 27
Allows for modification of other users nicknames.
MANAGE_ROLES  = 28
Allows management and editing of roles.
MANAGE_THREADS  = 34
Allows for deleting and archiving threads, and viewing all private threads.
MANAGE_WEBHOOKS  = 29
Allows management and editing of webhooks.
MENTION_EVERYONE  = 17
Allows for using the `@everyone` tag to notify all users in a channel, and the `@here` tag to notify all online users in a channel.
MODERATE_MEMBERS  = 40
Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels.
MOVE_MEMBERS  = 24
Allows for moving of members between voice channels.
MUTE_MEMBERS  = 22
Allows for muting members in a voice channel.
PIN_MESSAGES  = 51
Allows pinning and unpinning messages.
PRIORITY_SPEAKER  = 8
Allows for using priority speaker in a voice channel.
READ_MESSAGE_HISTORY  = 16
Allows for reading of message history.
REQUEST_TO_SPEAK  = 32
Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.)
ROLE_PERMISSIONS  = ['kick_members' => self::KICK_MEMBERS, 'ban_members' => self::BAN_MEMBERS, 'administrator' => self::ADMINISTRATOR, 'manage_guild' => self::MANAGE_GUILD, 'view_audit_log' => self::VIEW_AUDIT_LOG, 'view_guild_insights' => self::VIEW_GUILD_INSIGHTS, 'change_nickname' => self::CHANGE_NICKNAME, 'manage_nicknames' => self::MANAGE_NICKNAMES, 'manage_guild_expressions' => self::MANAGE_GUILD_EXPRESSIONS, 'moderate_members' => self::MODERATE_MEMBERS, 'view_creator_monetization_analytics' => self::VIEW_CREATOR_MONETIZATION_ANALYTICS]
Array of permissions that can only be applied to roles.
SEND_MESSAGES  = 11
Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads).
SEND_MESSAGES_IN_THREADS  = 38
Allows for sending messages in threads.
SEND_POLLS  = 49
Allows sending polls.
SEND_TTS_MESSAGES  = 12
Allows for sending of `/tts` messages.
SEND_VOICE_MESSAGES  = 46
Allows sending voice messages.
SPEAK  = 21
Allows for speaking in a voice channel.
STAGE_PERMISSIONS  = ['stream' => self::STREAM, 'connect' => self::CONNECT, 'mute_members' => self::MUTE_MEMBERS, 'move_members' => self::MOVE_MEMBERS, 'request_to_speak' => self::REQUEST_TO_SPEAK, 'manage_events' => self::MANAGE_EVENTS, 'create_events' => self::CREATE_EVENTS]
Array of permissions that only apply to stage channels.
STREAM  = 9
Allows the user to go live.
TEXT_PERMISSIONS  = ['manage_threads' => self::MANAGE_THREADS, 'create_public_threads' => self::CREATE_PUBLIC_THREADS, 'create_private_threads' => self::CREATE_PRIVATE_THREADS, 'send_messages_in_threads' => self::SEND_MESSAGES_IN_THREADS, 'pin_messages' => self::PIN_MESSAGES]
Array of permissions that only apply to text channels.
USE_APPLICATION_COMMANDS  = 31
Allows members to use application commands, including slash commands and context menu commands.
USE_EMBEDDED_ACTIVITIES  = 39
Allows for using Activities (applications with the EMBEDDED flag).
USE_EXTERNAL_APPS  = 50
Allows user-installed apps to send public responses. When disabled, users will still be allowed to use their apps but the responses will be ephemeral. This only applies to apps not also installed to the server.
USE_EXTERNAL_EMOJIS  = 18
Allows the usage of custom emojis from other servers.
USE_EXTERNAL_SOUNDS  = 45
Allows the usage of custom soundboard sounds from other servers.
USE_EXTERNAL_STICKERS  = 37
Allows the usage of custom stickers from other servers.
USE_SOUNDBOARD  = 42
Allows for using soundboard in a voice channel.
USE_VAD  = 25
Allows for using voice-activity-detection in a voice channel.
VIEW_AUDIT_LOG  = 7
Allows for viewing of audit logs.
VIEW_CHANNEL  = 10
Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels.
VIEW_CREATOR_MONETIZATION_ANALYTICS  = 41
Allows for viewing role subscription insights.
VIEW_GUILD_INSIGHTS  = 19
Allows for viewing guild insights.
VOICE_PERMISSIONS  = ['priority_speaker' => self::PRIORITY_SPEAKER, 'stream' => self::STREAM, 'connect' => self::CONNECT, 'speak' => self::SPEAK, 'mute_members' => self::MUTE_MEMBERS, 'deafen_members' => self::DEAFEN_MEMBERS, 'move_members' => self::MOVE_MEMBERS, 'use_vad' => self::USE_VAD, 'manage_events' => self::MANAGE_EVENTS, 'use_embedded_activities' => self::USE_EMBEDDED_ACTIVITIES, 'use_soundboard' => self::USE_SOUNDBOARD, 'create_events' => self::CREATE_EVENTS, 'use_external_sounds' => self::USE_EXTERNAL_SOUNDS, 'send_voice_messages' => self::SEND_VOICE_MESSAGES, 'send_polls' => self::SEND_POLLS]
Array of permissions that only apply to voice channels.

Properties

$add_reactions  : bool
$administrator  : bool
$attach_files  : bool
$ban_members  : bool
$bitwise  : int|string
$change_nickname  : bool
$connect  : bool
$create_events  : bool
$create_guild_expressions  : bool
$create_instant_invite  : bool
$create_private_threads  : bool
$create_public_threads  : bool
$created  : bool
Is the part already created in the Discord servers?
$deafen_members  : bool
$embed_links  : bool
$kick_members  : bool
$manage_channels  : bool
$manage_events  : bool
$manage_guild  : bool
$manage_guild_expressions  : bool
$manage_messages  : bool
$manage_nicknames  : bool
$manage_roles  : bool
$manage_threads  : bool
$manage_webhooks  : bool
$mention_everyone  : bool
$moderate_members  : bool
$move_members  : bool
$mute_members  : bool
$pin_messages  : bool
$priority_speaker  : bool
$read_message_history  : bool
$request_to_speak  : bool
$scriptData  : mixed
Custom script data.
$send_messages  : bool
$send_messages_in_threads  : bool
$send_polls  : bool
$send_tts_messages  : bool
$send_voice_messages  : bool
$speak  : bool
$stream  : bool
$use_application_commands  : bool
$use_embedded_activities  : bool
$use_external_apps  : bool
$use_external_emojis  : bool
$use_external_sounds  : bool
$use_external_stickers  : bool
$use_soundboard  : bool
$use_vad  : bool
$view_audit_log  : bool
$view_channel  : bool
$view_creator_monetization_analytics  : bool
$view_guild_insights  : bool
$attributes  : array<string|int, mixed>
The parts attributes.
$discord  : Discord
The Discord client.
$factory  : Factory
The factory.
$fillable  : array<string|int, mixed>
The parts fillable attributes.
$hidden  : array<string|int, mixed>
Attributes that are hidden from debug info.
$http  : Http
The HTTP client.
$repositories  : array<string|int, mixed>
An array of repositories that can exist in a part.
$repositories_cache  : array<string|int, mixed>
An array of repositories.
$visible  : array<string|int, mixed>
Attributes which are visible from debug info.

Methods

__construct()  : mixed
__debugInfo()  : array<string|int, mixed>
__get()  : mixed
Handles dynamic get calls onto the part.
__serialize()  : array<string|int, mixed>
__set()  : void
Handles dynamic set calls onto the part.
__toString()  : string
__unserialize()  : void
fetch()  : PromiseInterface<string|int, static>
Fetches any missing information about the part from Discord's servers.
fill()  : void
Fills the parts attributes from an array.
getConstants()  : array<string|int, mixed>
Returns an array of constant names and their values.
getCreatableAttributes()  : array<string|int, mixed>
Returns the attributes needed to create.
getDiscord()  : Discord
Get the Discord instance that owns this Part.
getPermissions()  : array<string|int, mixed>
Returns an array of extra permissions.
getPublicAttributes()  : array<string|int, mixed>
Returns an array of public attributes.
getRawAttributes()  : array<string|int, mixed>
Returns an array of raw attributes.
getRepositoryAttributes()  : array<string|int, mixed>
Gets the attributes to pass to repositories.
getUpdatableAttributes()  : array<string|int, mixed>
Returns the updatable attributes.
isPartial()  : bool
Whether the part is considered partial i.e. missing information which can be fetched from Discord.
jsonSerialize()  : array<string|int, mixed>
Provides data when the part is encoded into JSON. Used for JsonSerializable.
offsetExists()  : bool
Checks if an attribute exists via key. Used for ArrayAccess.
offsetGet()  : mixed
Gets an attribute via key. Used for ArrayAccess.
offsetSet()  : void
Sets an attribute via key. Used for ArrayAccess.
offsetUnset()  : void
Unsets an attribute via key. Used for ArrayAccess.
serialize()  : string|null
Serializes the data. Used for Serializable.
unserialize()  : void
Unserializes some data and stores it. Used for Serializable.
afterConstruct()  : void
Called after the part has been constructed.
getBitwiseAttribute()  : int|string
Gets the bitwise attribute of the permission.
getManageEmojisAndStickersAttribute()  : mixed
makeOptionalAttributes()  : array<string|int, mixed>
Return key-value attributes if it has been filled.
setBitwiseAttribute()  : void
Sets the bitwise attribute of the permission.
setManageEmojisAndStickersAttribute()  : void
checkForGetMutator()  : string|false
Checks if there is a get mutator present.
checkForSetMutator()  : string|false
Checks if there is a set mutator present.
getAttribute()  : mixed
Gets an attribute on the part.
setAttribute()  : void
Sets an attribute on the part.
studly()  : string
Converts a string to studlyCase.

Constants

ADD_REACTIONS

Allows for adding new reactions to messages. This permission does not apply to reacting with an existing reaction on a message.

public mixed ADD_REACTIONS = 6

ADMINISTRATOR

Allows all permissions and bypasses channel permission overwrites.

public mixed ADMINISTRATOR = 3

ALL_PERMISSIONS

Array of permissions for all roles.

public array<string|int, mixed> ALL_PERMISSIONS = ['create_instant_invite' => self::CREATE_INSTANT_INVITE, 'manage_channels' => self::MANAGE_CHANNELS, 'add_reactions' => self::ADD_REACTIONS, 'view_channel' => self::VIEW_CHANNEL, 'send_messages' => self::SEND_MESSAGES, 'send_tts_messages' => self::SEND_TTS_MESSAGES, 'manage_messages' => self::MANAGE_MESSAGES, 'embed_links' => self::EMBED_LINKS, 'attach_files' => self::ATTACH_FILES, 'read_message_history' => self::READ_MESSAGE_HISTORY, 'mention_everyone' => self::MENTION_EVERYONE, 'use_external_emojis' => self::USE_EXTERNAL_EMOJIS, 'manage_roles' => self::MANAGE_ROLES, 'manage_webhooks' => self::MANAGE_WEBHOOKS, 'use_application_commands' => self::USE_APPLICATION_COMMANDS, 'use_external_stickers' => self::USE_EXTERNAL_STICKERS, 'send_voice_messages' => self::SEND_VOICE_MESSAGES]

i.e. indicated T,V,S in documentation.

ATTACH_FILES

Allows for uploading images and files.

public mixed ATTACH_FILES = 15

BAN_MEMBERS

Allows banning members.

public mixed BAN_MEMBERS = 2

CHANGE_NICKNAME

Allows for modification of own nickname.

public mixed CHANGE_NICKNAME = 26

CONNECT

Allows for joining of a voice channel.

public mixed CONNECT = 20

CREATE_EVENTS

Allows for creating scheduled events, and editing and deleting those created by the current user. Not yet available to developers.

public mixed CREATE_EVENTS = 44

CREATE_GUILD_EXPRESSIONS

Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user. Not yet available to developers.

public mixed CREATE_GUILD_EXPRESSIONS = 43

CREATE_INSTANT_INVITE

Allows creation of instant invites.

public mixed CREATE_INSTANT_INVITE = 0

CREATE_PRIVATE_THREADS

Allows for creating private threads.

public mixed CREATE_PRIVATE_THREADS = 36

CREATE_PUBLIC_THREADS

Allows for creating public and announcement threads.

public mixed CREATE_PUBLIC_THREADS = 35

DEAFEN_MEMBERS

Allows for deafening of members in a voice channel.

public mixed DEAFEN_MEMBERS = 23

Links sent by users with this permission will be auto-embedded.

public mixed EMBED_LINKS = 14

KICK_MEMBERS

Allows kicking members.

public mixed KICK_MEMBERS = 1

MANAGE_CHANNELS

Allows management and editing of channels.

public mixed MANAGE_CHANNELS = 4

MANAGE_EVENTS

Allows for editing and deleting scheduled events created by all users.

public mixed MANAGE_EVENTS = 33

MANAGE_GUILD

Allows management and editing of the guild.

public mixed MANAGE_GUILD = 5

MANAGE_GUILD_EXPRESSIONS

Allows for editing and deleting emojis, stickers, and soundboard sounds created by all users.

public mixed MANAGE_GUILD_EXPRESSIONS = 30

MANAGE_MESSAGES

Allows for deletion of other users messages.

public mixed MANAGE_MESSAGES = 13

MANAGE_NICKNAMES

Allows for modification of other users nicknames.

public mixed MANAGE_NICKNAMES = 27

MANAGE_ROLES

Allows management and editing of roles.

public mixed MANAGE_ROLES = 28

MANAGE_THREADS

Allows for deleting and archiving threads, and viewing all private threads.

public mixed MANAGE_THREADS = 34

MANAGE_WEBHOOKS

Allows management and editing of webhooks.

public mixed MANAGE_WEBHOOKS = 29

MENTION_EVERYONE

Allows for using the `@everyone` tag to notify all users in a channel, and the `@here` tag to notify all online users in a channel.

public mixed MENTION_EVERYONE = 17

MODERATE_MEMBERS

Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels.

public mixed MODERATE_MEMBERS = 40

MOVE_MEMBERS

Allows for moving of members between voice channels.

public mixed MOVE_MEMBERS = 24

MUTE_MEMBERS

Allows for muting members in a voice channel.

public mixed MUTE_MEMBERS = 22

PIN_MESSAGES

Allows pinning and unpinning messages.

public mixed PIN_MESSAGES = 51

PRIORITY_SPEAKER

Allows for using priority speaker in a voice channel.

public mixed PRIORITY_SPEAKER = 8

READ_MESSAGE_HISTORY

Allows for reading of message history.

public mixed READ_MESSAGE_HISTORY = 16

REQUEST_TO_SPEAK

Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.)

public mixed REQUEST_TO_SPEAK = 32

ROLE_PERMISSIONS

Array of permissions that can only be applied to roles.

public array<string|int, mixed> ROLE_PERMISSIONS = ['kick_members' => self::KICK_MEMBERS, 'ban_members' => self::BAN_MEMBERS, 'administrator' => self::ADMINISTRATOR, 'manage_guild' => self::MANAGE_GUILD, 'view_audit_log' => self::VIEW_AUDIT_LOG, 'view_guild_insights' => self::VIEW_GUILD_INSIGHTS, 'change_nickname' => self::CHANGE_NICKNAME, 'manage_nicknames' => self::MANAGE_NICKNAMES, 'manage_guild_expressions' => self::MANAGE_GUILD_EXPRESSIONS, 'moderate_members' => self::MODERATE_MEMBERS, 'view_creator_monetization_analytics' => self::VIEW_CREATOR_MONETIZATION_ANALYTICS]

i.e. indicated empty in documentation.

Tags
see
RolePermission

SEND_MESSAGES

Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads).

public mixed SEND_MESSAGES = 11

SEND_MESSAGES_IN_THREADS

Allows for sending messages in threads.

public mixed SEND_MESSAGES_IN_THREADS = 38

SEND_POLLS

Allows sending polls.

public mixed SEND_POLLS = 49

SEND_TTS_MESSAGES

Allows for sending of `/tts` messages.

public mixed SEND_TTS_MESSAGES = 12

SEND_VOICE_MESSAGES

Allows sending voice messages.

public mixed SEND_VOICE_MESSAGES = 46

SPEAK

Allows for speaking in a voice channel.

public mixed SPEAK = 21

STAGE_PERMISSIONS

Array of permissions that only apply to stage channels.

public array<string|int, mixed> STAGE_PERMISSIONS = ['stream' => self::STREAM, 'connect' => self::CONNECT, 'mute_members' => self::MUTE_MEMBERS, 'move_members' => self::MOVE_MEMBERS, 'request_to_speak' => self::REQUEST_TO_SPEAK, 'manage_events' => self::MANAGE_EVENTS, 'create_events' => self::CREATE_EVENTS]

i.e. indicated S in documentation.

Tags
see
ChannelPermission

STREAM

Allows the user to go live.

public mixed STREAM = 9

TEXT_PERMISSIONS

Array of permissions that only apply to text channels.

public array<string|int, mixed> TEXT_PERMISSIONS = ['manage_threads' => self::MANAGE_THREADS, 'create_public_threads' => self::CREATE_PUBLIC_THREADS, 'create_private_threads' => self::CREATE_PRIVATE_THREADS, 'send_messages_in_threads' => self::SEND_MESSAGES_IN_THREADS, 'pin_messages' => self::PIN_MESSAGES]

i.e. indicated T in documentation.

The constant values here are the bit position, not the bitwise value

Tags
see
ChannelPermission

USE_APPLICATION_COMMANDS

Allows members to use application commands, including slash commands and context menu commands.

public mixed USE_APPLICATION_COMMANDS = 31

USE_EMBEDDED_ACTIVITIES

Allows for using Activities (applications with the EMBEDDED flag).

public mixed USE_EMBEDDED_ACTIVITIES = 39

USE_EXTERNAL_APPS

Allows user-installed apps to send public responses. When disabled, users will still be allowed to use their apps but the responses will be ephemeral. This only applies to apps not also installed to the server.

public mixed USE_EXTERNAL_APPS = 50

USE_EXTERNAL_EMOJIS

Allows the usage of custom emojis from other servers.

public mixed USE_EXTERNAL_EMOJIS = 18

USE_EXTERNAL_SOUNDS

Allows the usage of custom soundboard sounds from other servers.

public mixed USE_EXTERNAL_SOUNDS = 45

USE_EXTERNAL_STICKERS

Allows the usage of custom stickers from other servers.

public mixed USE_EXTERNAL_STICKERS = 37

USE_SOUNDBOARD

Allows for using soundboard in a voice channel.

public mixed USE_SOUNDBOARD = 42

USE_VAD

Allows for using voice-activity-detection in a voice channel.

public mixed USE_VAD = 25

VIEW_AUDIT_LOG

Allows for viewing of audit logs.

public mixed VIEW_AUDIT_LOG = 7

VIEW_CHANNEL

Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels.

public mixed VIEW_CHANNEL = 10

VIEW_CREATOR_MONETIZATION_ANALYTICS

Allows for viewing role subscription insights.

public mixed VIEW_CREATOR_MONETIZATION_ANALYTICS = 41

VIEW_GUILD_INSIGHTS

Allows for viewing guild insights.

public mixed VIEW_GUILD_INSIGHTS = 19

VOICE_PERMISSIONS

Array of permissions that only apply to voice channels.

public array<string|int, mixed> VOICE_PERMISSIONS = ['priority_speaker' => self::PRIORITY_SPEAKER, 'stream' => self::STREAM, 'connect' => self::CONNECT, 'speak' => self::SPEAK, 'mute_members' => self::MUTE_MEMBERS, 'deafen_members' => self::DEAFEN_MEMBERS, 'move_members' => self::MOVE_MEMBERS, 'use_vad' => self::USE_VAD, 'manage_events' => self::MANAGE_EVENTS, 'use_embedded_activities' => self::USE_EMBEDDED_ACTIVITIES, 'use_soundboard' => self::USE_SOUNDBOARD, 'create_events' => self::CREATE_EVENTS, 'use_external_sounds' => self::USE_EXTERNAL_SOUNDS, 'send_voice_messages' => self::SEND_VOICE_MESSAGES, 'send_polls' => self::SEND_POLLS]

i.e. indicated V in documentation.

Tags
see
ChannelPermission

Properties

$add_reactions

public bool $add_reactions

Allows for adding new reactions to messages

$administrator

public bool $administrator

Allows all permissions and bypasses channel permission overwrites

$attach_files

public bool $attach_files

Allows for uploading images and files

$ban_members

public bool $ban_members

Allows banning members

$bitwise

public int|string $bitwise

Bitwise value of the enabled/disabled permissions

$change_nickname

public bool $change_nickname

Allows for modification of own nickname

$create_events

public bool $create_events

Allows for creating scheduled events

$create_guild_expressions

public bool $create_guild_expressions

Allows for creating emojis, stickers, and soundboard sounds, and editing and deleting those created by the current user

$create_instant_invite

public bool $create_instant_invite

Allows creation of instant invites

$create_private_threads

public bool $create_private_threads

Allows for creating private threads

$create_public_threads

public bool $create_public_threads

Allows for creating public and announcement threads

$created

Is the part already created in the Discord servers?

public bool $created = false

Whether the part has been created.

$deafen_members

public bool $deafen_members

Allows for deafening of members in a voice channel

public bool $embed_links

Links sent by users with this permission will be auto-embedded

$kick_members

public bool $kick_members

Allows kicking members

$manage_channels

public bool $manage_channels

Allows management and editing of channels

$manage_events

public bool $manage_events

Allows for editing and deleting scheduled events

$manage_guild

public bool $manage_guild

Allows management and editing of the guild

$manage_guild_expressions

public bool $manage_guild_expressions

Allows for editing and deleting emojis, stickers, and soundboard sounds created by all users

$manage_messages

public bool $manage_messages

Allows for deletion of other users messages

$manage_nicknames

public bool $manage_nicknames

Allows for modification of other users nicknames

$manage_roles

public bool $manage_roles

Allows management and editing of roles

$manage_threads

public bool $manage_threads

Allows for deleting and archiving threads, and viewing all private threads

$manage_webhooks

public bool $manage_webhooks

Allows management and editing of webhooks

$mention_everyone

public bool $mention_everyone

Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel

$moderate_members

public bool $moderate_members

Allows for timing out users to prevent them from sending or reacting to messages in chat and threads, and from speaking in voice and stage channels

$move_members

public bool $move_members

Allows for moving of members between voice channels

$mute_members

public bool $mute_members

Allows for muting members in a voice channel

$pin_messages

public bool $pin_messages

Allows pinning and unpinning messages

$priority_speaker

public bool $priority_speaker

Allows for using priority speaker in a voice channel

$read_message_history

public bool $read_message_history

Allows for reading of message history

$request_to_speak

public bool $request_to_speak

Allows for requesting to speak in stage channels. (This permission is under active development and may be changed or removed.)

$scriptData

Custom script data.

Relying on this variable with dynamic caching is discouraged.

public mixed $scriptData

Used for storing custom information, used by end products.

$send_messages

public bool $send_messages

Allows for sending messages in a channel and creating threads in a forum (does not allow sending messages in threads)

$send_messages_in_threads

public bool $send_messages_in_threads

Allows for sending messages in threads

$send_tts_messages

public bool $send_tts_messages

Allows for sending of /tts messages

$send_voice_messages

public bool $send_voice_messages

Allows sending voice messages

$use_application_commands

public bool $use_application_commands

Allows members to use application commands, including slash commands and context menu commands

$use_embedded_activities

public bool $use_embedded_activities

Allows for using Activities (applications with the EMBEDDED flag) in a voice channel

$use_external_apps

public bool $use_external_apps

Allows user-installed apps to send public responses. When disabled, users will still be allowed to use their apps but the responses will be ephemeral. This only applies to apps not also installed to the server.

$use_external_emojis

public bool $use_external_emojis

Allows the usage of custom emojis from other servers

$use_external_sounds

public bool $use_external_sounds

Allows the usage of custom soundboard sounds from other servers

$use_external_stickers

public bool $use_external_stickers

Allows the usage of custom stickers from other servers

$use_soundboard

public bool $use_soundboard

Allows for using soundboard in a voice channel

$use_vad

public bool $use_vad

Allows for using voice-activity-detection in a voice channel

$view_audit_log

public bool $view_audit_log

Allows for viewing of audit logs

$view_channel

public bool $view_channel

Allows guild members to view a channel, which includes reading messages in text channels and joining voice channels

$view_creator_monetization_analytics

public bool $view_creator_monetization_analytics

Allows for viewing role subscription insights

$view_guild_insights

public bool $view_guild_insights

Allows for viewing guild insights

$attributes

The parts attributes.

protected array<string|int, mixed> $attributes = []

The parts attributes and content.

$discord

The Discord client.

protected Discord $discord

Client.

$fillable

The parts fillable attributes.

protected array<string|int, mixed> $fillable = []

The array of attributes that can be mass-assigned.

$hidden

Attributes that are hidden from debug info.

protected array<string|int, mixed> $hidden = []

Attributes that are hidden from public.

$http

The HTTP client.

protected Http $http

Client.

$repositories

An array of repositories that can exist in a part.

protected array<string|int, mixed> $repositories = []

Repositories.

$repositories_cache

An array of repositories.

protected array<string|int, mixed> $repositories_cache = []

$visible

Attributes which are visible from debug info.

protected array<string|int, mixed> $visible = []

Methods

__construct()

public __construct(Discord $discord[, array<string|int, mixed> $attributes = [] ][, bool $created = false ]) : mixed
Parameters
$discord : Discord
$attributes : array<string|int, mixed> = []
$created : bool = false
Tags
inheritDoc

__debugInfo()

public __debugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

__get()

Handles dynamic get calls onto the part.

public __get(string $key) : mixed
Parameters
$key : string

The attributes key.

Tags
throws
Exception
see
Part::getAttribute()

This function forwards onto getAttribute.

Return values
mixed

The value of the attribute.

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__set()

Handles dynamic set calls onto the part.

public __set(string $key, mixed $value) : void
Parameters
$key : string

The attributes key.

$value : mixed

The attributes value.

Tags
see
self::setAttribute()

This function forwards onto setAttribute.

__toString()

public __toString() : string
Return values
string

__unserialize()

public __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

fetch()

Fetches any missing information about the part from Discord's servers.

public fetch() : PromiseInterface<string|int, static>
Tags
throws
RuntimeException

The part is not fetchable.

Return values
PromiseInterface<string|int, static>

fill()

Fills the parts attributes from an array.

public fill(array<string|int, mixed> $attributes) : void
Parameters
$attributes : array<string|int, mixed>

An array of attributes to build the part.

Tags
see
self::setAttribute()

getConstants()

Returns an array of constant names and their values.

public getConstants() : array<string|int, mixed>
Tags
since
10.19.0
Return values
array<string|int, mixed>

An associative array where keys are constant names and values are their values.

getCreatableAttributes()

Returns the attributes needed to create.

public getCreatableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPermissions()

Returns an array of extra permissions.

public static getPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPublicAttributes()

Returns an array of public attributes.

public getPublicAttributes() : array<string|int, mixed>
Tags
throws
Exception
Return values
array<string|int, mixed>

An array of public attributes.

getRawAttributes()

Returns an array of raw attributes.

public getRawAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

Raw attributes.

getRepositoryAttributes()

Gets the attributes to pass to repositories.

public getRepositoryAttributes() : array<string|int, mixed>

Note: The order matters for repository tree (top to bottom).

Return values
array<string|int, mixed>

Attributes.

getUpdatableAttributes()

Returns the updatable attributes.

public getUpdatableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

isPartial()

Whether the part is considered partial i.e. missing information which can be fetched from Discord.

public isPartial() : bool
Return values
bool

jsonSerialize()

Provides data when the part is encoded into JSON. Used for JsonSerializable.

public jsonSerialize() : array<string|int, mixed>
Tags
throws
Exception
see
Part::getPublicAttributes()

This function forwards onto getPublicAttributes.

Return values
array<string|int, mixed>

An array of public attributes.

offsetExists()

Checks if an attribute exists via key. Used for ArrayAccess.

public offsetExists(string $key) : bool
Parameters
$key : string

The attribute key.

Return values
bool

Whether the offset exists.

offsetGet()

Gets an attribute via key. Used for ArrayAccess.

public offsetGet(string $key) : mixed
Parameters
$key : string

The attribute key.

Tags
throws
Exception
see
Part::getAttribute()

This function forwards onto getAttribute.

Attributes
#[ReturnTypeWillChange]

offsetSet()

Sets an attribute via key. Used for ArrayAccess.

public offsetSet(string $key, mixed $value) : void
Parameters
$key : string

The attribute key.

$value : mixed

The attribute value.

Tags
see
Part::setAttribute()

This function forwards onto setAttribute.

offsetUnset()

Unsets an attribute via key. Used for ArrayAccess.

public offsetUnset(string $key) : void
Parameters
$key : string

The attribute key.

serialize()

Serializes the data. Used for Serializable.

public serialize() : string|null
Return values
string|null

A string of serialized data.

unserialize()

Unserializes some data and stores it. Used for Serializable.

public unserialize(string $data) : void
Parameters
$data : string

Some serialized data.

Tags
see
Part::setAttribute()

The unserialized data is stored with setAttribute.

afterConstruct()

Called after the part has been constructed.

protected afterConstruct() : void

getManageEmojisAndStickersAttribute()

protected getManageEmojisAndStickersAttribute() : mixed

Use manage_guild_expressions

makeOptionalAttributes()

Return key-value attributes if it has been filled.

protected makeOptionalAttributes(array<string|int, mixed> $attributes) : array<string|int, mixed>

To be used with fields marked "optional?" from the API.

Parameters
$attributes : array<string|int, mixed>

Names of optional attribute

Return values
array<string|int, mixed>

setManageEmojisAndStickersAttribute()

protected setManageEmojisAndStickersAttribute(bool $value) : void

Use manage_guild_expressions

Parameters
$value : bool

checkForGetMutator()

Checks if there is a get mutator present.

private checkForGetMutator(string $key) : string|false
Parameters
$key : string

The attribute name to check.

Tags
since
10.0.0

Replaces checkForMutator($key, 'get')

Return values
string|false

Either a string if it is a method or false.

checkForSetMutator()

Checks if there is a set mutator present.

private checkForSetMutator(string $key) : string|false
Parameters
$key : string

The attribute name to check.

Tags
since
10.0.0

Replaces checkForMutator($key, 'set')

Return values
string|false

Either a string if it is a method or false.

getAttribute()

Gets an attribute on the part.

private getAttribute(string $key) : mixed
Parameters
$key : string

The key to the attribute.

Tags
throws
Exception
Return values
mixed

Either the attribute if it exists or void.

setAttribute()

Sets an attribute on the part.

private setAttribute(string $key, mixed $value) : void
Parameters
$key : string

The key to the attribute.

$value : mixed

The value of the attribute.

studly()

Converts a string to studlyCase.

private static studly(string $string) : string

This is a port of updated Laravel's implementation, a non-regex with static cache. The Discord\studly() is kept due to unintended bug and we do not want to introduce BC by replacing it. This method is private static as we may move it outside this class in future.

Parameters
$string : string

The string to convert.

Tags
since
10.0.0
Return values
string

        
On this page

Search results