Channel
extends Part
in package
implements
Stringable
A Channel can be either a text or voice channel on a Discord guild.
Tags
Table of Contents
Interfaces
- Stringable
Constants
- FLAG_PINNED = 1 << 1
- FLAG_REQUIRE_TAG = 1 << 4
- FORUM_LAYOUT_GRID_VIEW = 2
- FORUM_LAYOUT_LIST_VIEW = 1
- FORUM_LAYOUT_NOT_SET = 0
- SORT_ORDER_CREATION_DATE = 1
- SORT_ORDER_LATEST_ACTIVITY = 0
- TYPE_ANNOUNCEMENT = self::TYPE_GUILD_ANNOUNCEMENT
- TYPE_ANNOUNCEMENT_THREAD = 10
- TYPE_CATEGORY = self::TYPE_GUILD_CATEGORY
- TYPE_DIRECTORY = self::TYPE_GUILD_DIRECTORY
- TYPE_DM = 1
- TYPE_FORUM = self::TYPE_GUILD_FORUM
- TYPE_GROUP = self::TYPE_GROUP_DM
- TYPE_GROUP_DM = 3
- TYPE_GUILD_ANNOUNCEMENT = 5
- TYPE_GUILD_CATEGORY = 4
- TYPE_GUILD_DIRECTORY = 14
- TYPE_GUILD_FORUM = 15
- TYPE_GUILD_MEDIA = 16
- TYPE_GUILD_STAGE_VOICE = 13
- TYPE_GUILD_TEXT = 0
- TYPE_GUILD_VOICE = 2
- TYPE_NEWS = self::TYPE_GUILD_ANNOUNCEMENT
- TYPE_NEWS_THREAD = self::TYPE_ANNOUNCEMENT_THREAD
- TYPE_PRIVATE_THREAD = 12
- TYPE_PUBLIC_THREAD = 11
- TYPE_STAGE_CHANNEL = self::TYPE_GUILD_STAGE_VOICE
- TYPE_TEXT = self::TYPE_GUILD_TEXT
- TYPE_VOICE = self::TYPE_GUILD_VOICE
- VIDEO_QUALITY_AUTO = 1
- VIDEO_QUALITY_FULL = 2
Properties
- $application_id : string|null
- $available_tags : CollectionInterface|array<string|int, Tag>
- $bitrate : int|null
- $created : bool
- Is the part already created in the Discord servers?
- $default_auto_archive_duration : int|null
- $default_forum_layout : int|null
- $default_thread_rate_limit_per_user : int|null
- $flags : int|null
- $guild : Guild|null
- $guild_id : string|null
- $id : string
- $invites : InviteRepository
- $is_private : bool
- $last_pin_timestamp : Carbon|null
- $managed : bool|null
- $members : VoiceMemberRepository
- $messages : MessageRepository
- $nsfw : bool|null
- $overwrites : OverwriteRepository
- $owner_id : string|null
- $permissions : string|null
- $position : int|null
- $rate_limit_per_user : int|null
- $recipient : User|null
- $recipient_id : string|null
- $recipients : CollectionInterface|array<string|int, User>
- $scriptData : mixed
- Custom script data.
- $stage_instances : StageInstanceRepository
- $threads : ThreadRepository
- $type : int
- $user_limit : int|null
- $video_quality_mode : int|null
- $webhooks : WebhookRepository
- $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
- Create a new part instance.
- __debugInfo() : array<string|int, mixed>
- Handles debug calls from var_dump and similar functions.
- __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
- Returns a formatted mention for text channel or name of the channel.
- __unserialize() : void
- allowInvite() : bool
- Returns if allow invite.
- allowText() : bool
- Returns if allow text.
- allowVoice() : bool
- Returns if allow voice.
- broadcastTyping() : PromiseInterface
- Broadcasts that you are typing to the channel. Lasts for 5 seconds.
- canInvite() : bool
- Returns if invite can be created in this type of channel.
- createInvite() : PromiseInterface<string|int, Invite>
- Creates an invite for the channel.
- createMessageCollector() : PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>
- Creates a message collector for the channel.
- deafenMember() : PromiseInterface<string|int, Member>
- Deafens a member in the voice channel.
- deleteMessages() : PromiseInterface
- Bulk deletes an array of messages.
- 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.
- getBotPermissions() : RolePermission|null
- Returns the bot's permissions in the channel.
- getCreatableAttributes() : array<string|int, mixed>
- getDiscord() : Discord
- Get the Discord instance that owns this Part.
- getMessageHistory() : PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>
- Fetches message history.
- getPinnedMessages() : PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>
- Returns the channels pinned messages.
- 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>
- getUpdatableAttributes() : array<string|int, mixed>
- isPartial() : bool
- Whether the part is considered partial i.e. missing information which can be fetched from Discord.
- isTextBased() : bool
- Returns if channel type is text based.
- isVoiceBased() : bool
- Returns if channel type is voice based.
- jsonSerialize() : array<string|int, mixed>
- Provides data when the part is encoded into JSON. Used for JsonSerializable.
- limitDelete() : PromiseInterface
- Deletes a given number of messages, in order of time sent.
- moveMember() : PromiseInterface<string|int, Member>
- Moves a member to another voice channel.
- muteMember() : PromiseInterface<string|int, Member>
- Mutes a member on a voice channel.
- 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.
- pinMessage() : PromiseInterface<string|int, Message>
- Adds a message to the channels pinboard.
- sendEmbed() : PromiseInterface<string|int, Message>
- Sends an embed to the channel.
- sendFile() : PromiseInterface<string|int, Message>
- Sends a file to the channel.
- sendMessage() : PromiseInterface<string|int, Message>
- sendMessage() : PromiseInterface<string|int, Message>
- Sends a message to the channel.
- serialize() : string|null
- Serializes the data. Used for Serializable.
- setCategory() : PromiseInterface<string|int, self>
- Change category of a channel.
- setOverwrite() : PromiseInterface
- Sets an overwrite to the channel.
- setPermissions() : PromiseInterface
- Sets permissions in a channel.
- startThread() : PromiseInterface<string|int, Thread>
- Starts a thread in the channel.
- undeafenMember() : PromiseInterface<string|int, Member>
- Undeafens a member in the voice channel.
- unmuteMember() : PromiseInterface<string|int, Member>
- Unmutes a member on a voice channel.
- unpinMessage() : PromiseInterface
- Removes a message from the channels pinboard.
- unserialize() : void
- Unserializes some data and stores it. Used for Serializable.
- afterConstruct() : void
- {@inheritDoc}
- getAvailableTagsAttribute() : CollectionInterface|array<string|int, Tag>
- Gets the available tags attribute.
- getDefaultReactionEmojiAttribute() : Reaction|null
- Gets the default reaction emoji attribute.
- getGuildAttribute() : Guild|null
- Returns the guild attribute.
- getIsPrivateAttribute() : bool
- Gets the is_private attribute.
- getLastPinTimestampAttribute() : Carbon|null
- Gets the last pinned message timestamp.
- getPermissionOverwritesAttribute() : array<string|int, mixed>|null
- Gets the permission overwrites attribute.
- getRecipientAttribute() : User|null
- Gets the recipient attribute.
- getRecipientIdAttribute() : string|null
- Gets the recipient ID attribute.
- getRecipientsAttribute() : CollectionInterface
- Gets the recipients attribute.
- makeOptionalAttributes() : array<string|int, mixed>
- Return key-value attributes if it has been filled.
- setPermissionOverwritesAttribute() : void
- Sets the permission overwrites attribute.
- 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
FLAG_PINNED
Use Thread::FLAG_PINNED
public
mixed
FLAG_PINNED
= 1 << 1
FLAG_REQUIRE_TAG
public
mixed
FLAG_REQUIRE_TAG
= 1 << 4
FORUM_LAYOUT_GRID_VIEW
public
mixed
FORUM_LAYOUT_GRID_VIEW
= 2
FORUM_LAYOUT_LIST_VIEW
public
mixed
FORUM_LAYOUT_LIST_VIEW
= 1
FORUM_LAYOUT_NOT_SET
public
mixed
FORUM_LAYOUT_NOT_SET
= 0
SORT_ORDER_CREATION_DATE
public
mixed
SORT_ORDER_CREATION_DATE
= 1
SORT_ORDER_LATEST_ACTIVITY
public
mixed
SORT_ORDER_LATEST_ACTIVITY
= 0
TYPE_ANNOUNCEMENT
Use Channel::TYPE_GUILD_ANNOUNCEMENT
public
mixed
TYPE_ANNOUNCEMENT
= self::TYPE_GUILD_ANNOUNCEMENT
TYPE_ANNOUNCEMENT_THREAD
public
mixed
TYPE_ANNOUNCEMENT_THREAD
= 10
TYPE_CATEGORY
Use Channel::TYPE_GUILD_CATEGORY
public
mixed
TYPE_CATEGORY
= self::TYPE_GUILD_CATEGORY
TYPE_DIRECTORY
Use Channel::TYPE_GUILD_DIRECTORY
public
mixed
TYPE_DIRECTORY
= self::TYPE_GUILD_DIRECTORY
TYPE_DM
public
mixed
TYPE_DM
= 1
TYPE_FORUM
Use Channel::TYPE_GUILD_FORUM
public
mixed
TYPE_FORUM
= self::TYPE_GUILD_FORUM
TYPE_GROUP
Use Channel::TYPE_GROUP_DM
public
mixed
TYPE_GROUP
= self::TYPE_GROUP_DM
TYPE_GROUP_DM
public
mixed
TYPE_GROUP_DM
= 3
TYPE_GUILD_ANNOUNCEMENT
public
mixed
TYPE_GUILD_ANNOUNCEMENT
= 5
TYPE_GUILD_CATEGORY
public
mixed
TYPE_GUILD_CATEGORY
= 4
TYPE_GUILD_DIRECTORY
public
mixed
TYPE_GUILD_DIRECTORY
= 14
TYPE_GUILD_FORUM
public
mixed
TYPE_GUILD_FORUM
= 15
TYPE_GUILD_MEDIA
public
mixed
TYPE_GUILD_MEDIA
= 16
TYPE_GUILD_STAGE_VOICE
public
mixed
TYPE_GUILD_STAGE_VOICE
= 13
TYPE_GUILD_TEXT
public
mixed
TYPE_GUILD_TEXT
= 0
TYPE_GUILD_VOICE
public
mixed
TYPE_GUILD_VOICE
= 2
TYPE_NEWS
Use Channel::TYPE_GUILD_ANNOUNCEMENT
public
mixed
TYPE_NEWS
= self::TYPE_GUILD_ANNOUNCEMENT
TYPE_NEWS_THREAD
Use Channel::TYPE_ANNOUNCEMENT_THREAD
public
mixed
TYPE_NEWS_THREAD
= self::TYPE_ANNOUNCEMENT_THREAD
TYPE_PRIVATE_THREAD
public
mixed
TYPE_PRIVATE_THREAD
= 12
TYPE_PUBLIC_THREAD
public
mixed
TYPE_PUBLIC_THREAD
= 11
TYPE_STAGE_CHANNEL
Use Channel::TYPE_GUILD_STAGE_VOICE
public
mixed
TYPE_STAGE_CHANNEL
= self::TYPE_GUILD_STAGE_VOICE
TYPE_TEXT
Use Channel::TYPE_GUILD_TEXT
public
mixed
TYPE_TEXT
= self::TYPE_GUILD_TEXT
TYPE_VOICE
Use Channel::TYPE_GUILD_VOICE
public
mixed
TYPE_VOICE
= self::TYPE_GUILD_VOICE
VIDEO_QUALITY_AUTO
public
mixed
VIDEO_QUALITY_AUTO
= 1
VIDEO_QUALITY_FULL
public
mixed
VIDEO_QUALITY_FULL
= 2
Properties
$application_id
public
string|null
$application_id
ID of the group DM creator if it is a bot.
$available_tags
public
CollectionInterface|array<string|int, Tag>
$available_tags
Set of tags that can be used in a forum channel, limited to 20.
$bitrate
public
int|null
$bitrate
The bitrate of the channel. Only for voice channels.
$created
Is the part already created in the Discord servers?
public
bool
$created
= false
Whether the part has been created.
$default_auto_archive_duration
public
int|null
$default_auto_archive_duration
Default duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080.
$default_forum_layout
public
int|null
$default_forum_layout
The default layout type used to display posts in a forum channel. Defaults to 0
, which indicates a layout view has not been set by a channel admin.
$default_thread_rate_limit_per_user
public
int|null
$default_thread_rate_limit_per_user
The initial rate_limit_per_user to set on newly created threads in a forum channel. this field is copied to the thread at creation time and does not live update.
$flags
public
int|null
$flags
Channel flags combined as a bitfield.
$guild read-only
public
Guild|null
$guild
The guild that the channel belongs to. Only for text or voice channels.
$guild_id
public
string|null
$guild_id
The unique identifier of the guild that the channel belongs to. Only for text or voice channels.
$id
public
string
$id
The unique identifier of the Channel.
$invites
public
InviteRepository
$invites
Invites in the channel.
$is_private
public
bool
$is_private
Whether the channel is a private channel.
$last_pin_timestamp
public
Carbon|null
$last_pin_timestamp
When the last message was pinned.
$managed
public
bool|null
$managed
Whether the channel is managed by an application via the gdm.join
OAuth2 scope. Only for group DM channels.
$members
public
VoiceMemberRepository
$members
Voice channel only - members in the channel.
$messages
public
MessageRepository
$messages
Text channel only - messages sent in the channel.
$nsfw
public
bool|null
$nsfw
Whether the channel is NSFW.
$overwrites
public
OverwriteRepository
$overwrites
Permission overwrites
$owner_id
public
string|null
$owner_id
The ID of the DM creator. Only for DM or group channels.
$permissions
public
string|null
$permissions
Computed permissions for the invoking user in the channel, including overwrites, only included when part of the resolved data received on an application command interaction.
$position
public
int|null
$position
The position of the channel on the sidebar.
$rate_limit_per_user
public
int|null
$rate_limit_per_user
Amount of seconds a user has to wait before sending a new message (slow mode).
$recipient read-only
public
User|null
$recipient
The first recipient of the channel. Only for DM or group channels.
$recipient_id read-only
public
string|null
$recipient_id
The ID of the recipient of the channel, if it is a DM channel.
$recipients
public
CollectionInterface|array<string|int, User>
$recipients
A collection of all the recipients in the channel. Only for DM or group channels.
$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.
$stage_instances
public
StageInstanceRepository
$stage_instances
Stage instances in the channel.
$threads
public
ThreadRepository
$threads
Threads that belong to the channel.
$type
public
int
$type
The type of the channel.
$user_limit
public
int|null
$user_limit
The user limit of the channel. Max 99 for voice channels and 10000 for stage channels (0 refers to no limit).
$video_quality_mode
public
int|null
$video_quality_mode
The camera video quality mode of the voice channel, 1 when not present.
$webhooks
public
WebhookRepository
$webhooks
Webhooks in the channel.
$attributes
The parts attributes.
protected
array<string|int, mixed>
$attributes
= []
The parts attributes and content.
$discord
The Discord client.
protected
Discord
$discord
Client.
$factory
The factory.
protected
Factory
$factory
Factory.
$fillable
The parts fillable attributes.
protected
array<string|int, mixed>
$fillable
= [
'id',
'type',
'guild_id',
'position',
'name',
'topic',
'nsfw',
'last_message_id',
'bitrate',
'user_limit',
'rate_limit_per_user',
'recipients',
'icon',
'owner_id',
'application_id',
'managed',
'parent_id',
'last_pin_timestamp',
'rtc_region',
'video_quality_mode',
'default_auto_archive_duration',
'permissions',
'flags',
'available_tags',
'default_reaction_emoji',
'default_thread_rate_limit_per_user',
'default_sort_order',
'default_forum_layout',
// @internal
'is_private',
// repositories
'permission_overwrites',
]
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
= ['overwrites' => \Discord\Repository\Channel\OverwriteRepository::class, 'members' => \Discord\Repository\Channel\VoiceMemberRepository::class, 'messages' => \Discord\Repository\Channel\MessageRepository::class, 'webhooks' => \Discord\Repository\Channel\WebhookRepository::class, 'threads' => \Discord\Repository\Channel\ThreadRepository::class, 'invites' => \Discord\Repository\Channel\InviteRepository::class, 'stage_instances' => \Discord\Repository\Channel\StageInstanceRepository::class]
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()
Create a new part instance.
public
__construct(Discord $discord[, array<string|int, mixed> $attributes = [] ][, bool $created = false ]) : mixed
Parameters
- $discord : Discord
-
The Discord client.
- $attributes : array<string|int, mixed> = []
-
An array of attributes to build the part.
- $created : bool = false
-
Whether the part has already been created.
__debugInfo()
Handles debug calls from var_dump and similar functions.
public
__debugInfo() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array of public attributes.
__get()
Handles dynamic get calls onto the part.
public
__get(string $key) : mixed
Parameters
- $key : string
-
The attributes key.
Tags
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
__toString()
Returns a formatted mention for text channel or name of the channel.
public
__toString() : string
Return values
string —A formatted mention for text channel or name of the channel.
__unserialize()
public
__unserialize(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
allowInvite()
Returns if allow invite.
public
allowInvite() : bool
Use Channel::canInvite()
Return values
bool —if we can make invite or not.
allowText()
Returns if allow text.
public
allowText() : bool
Use Channel::isTextBased()
Return values
bool —if we can send text or not.
allowVoice()
Returns if allow voice.
public
allowVoice() : bool
Use Channel::isVoiceBased()
Return values
bool —if we can send voice or not.
broadcastTyping()
Broadcasts that you are typing to the channel. Lasts for 5 seconds.
public
broadcastTyping() : PromiseInterface
Tags
Return values
PromiseInterfacecanInvite()
Returns if invite can be created in this type of channel.
public
canInvite() : bool
Return values
bool —Whether the channel type is possible for creating invite.
createInvite()
Creates an invite for the channel.
public
createInvite([string $options = [] ][, string|null $reason = null ]) : PromiseInterface<string|int, Invite>
Parameters
- $options : string = []
-
['target_application_id'] The id of the embedded application to open for this invite, required if target_type is
Invite::TARGET_TYPE_EMBEDDED_APPLICATION
, the application must have the EMBEDDED flag. - $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterface<string|int, Invite>createMessageCollector()
Creates a message collector for the channel.
public
createMessageCollector(callable $filter[, int $options = [] ]) : PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>
Parameters
- $filter : callable
-
The filter function. Returns true or false.
- $options : int = []
-
['limit'] The amount of messages allowed or false.
Return values
PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>deafenMember()
Deafens a member in the voice channel.
public
deafenMember(Member|string $member[, string|null $reason = null ]) : PromiseInterface<string|int, Member>
Parameters
- $member : Member|string
-
The member to deafen. (either a Member part or the member ID)
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterface<string|int, Member>deleteMessages()
Bulk deletes an array of messages.
public
deleteMessages(array<string|int, mixed>|Traversable $messages[, string|null $reason = null ]) : PromiseInterface
Parameters
- $messages : array<string|int, mixed>|Traversable
-
An array of messages to delete.
- $reason : string|null = null
-
Reason for Audit Log (only for bulk messages).
Tags
Return values
PromiseInterfacefetch()
Fetches any missing information about the part from Discord's servers.
public
fetch() : PromiseInterface<string|int, static>
Tags
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
getBotPermissions()
Returns the bot's permissions in the channel.
public
getBotPermissions() : RolePermission|null
Return values
RolePermission|nullgetCreatableAttributes()
public
getCreatableAttributes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getDiscord()
Get the Discord instance that owns this Part.
public
getDiscord() : Discord
Return values
DiscordgetMessageHistory()
Fetches message history.
public
getMessageHistory([int|null $options = [] ]) : PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>
Parameters
- $options : int|null = []
-
['limit'] Max number of messages to return (1-100). Defaults to 50.
Tags
Return values
PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>getPinnedMessages()
Returns the channels pinned messages.
public
getPinnedMessages() : PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>
Tags
Return values
PromiseInterface<string|int, Collection<string|int, array<string|int, Message>>>getPublicAttributes()
Returns an array of public attributes.
public
getPublicAttributes() : array<string|int, mixed>
Tags
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()
public
getRepositoryAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getUpdatableAttributes()
public
getUpdatableAttributes() : array<string|int, mixed>
Tags
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
boolisTextBased()
Returns if channel type is text based.
public
isTextBased() : bool
Return values
bool —Whether the channel is possible for sending text.
isVoiceBased()
Returns if channel type is voice based.
public
isVoiceBased() : bool
Return values
bool —Whether the channel is possible for voice.
jsonSerialize()
Provides data when the part is encoded into JSON. Used for JsonSerializable.
public
jsonSerialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —An array of public attributes.
limitDelete()
Deletes a given number of messages, in order of time sent.
public
limitDelete(int $value[, string|null $reason = null ]) : PromiseInterface
Parameters
- $value : int
- $reason : string|null = null
-
Reason for Audit Log (only for bulk messages).
Tags
Return values
PromiseInterfacemoveMember()
Moves a member to another voice channel.
public
moveMember(Member|string $member[, string|null $reason = null ]) : PromiseInterface<string|int, Member>
Parameters
- $member : Member|string
-
The member to move. (either a Member part or the member ID)
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterface<string|int, Member>muteMember()
Mutes a member on a voice channel.
public
muteMember(Member|string $member[, string|null $reason = null ]) : PromiseInterface<string|int, Member>
Parameters
- $member : Member|string
-
The member to mute. (either a Member part or the member ID)
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterface<string|int, Member>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
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
offsetUnset()
Unsets an attribute via key. Used for ArrayAccess.
public
offsetUnset(string $key) : void
Parameters
- $key : string
-
The attribute key.
pinMessage()
Adds a message to the channels pinboard.
public
pinMessage(Message $message[, string|null $reason = null ]) : PromiseInterface<string|int, Message>
Parameters
- $message : Message
-
The message to pin.
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterface<string|int, Message>sendEmbed()
Sends an embed to the channel.
public
sendEmbed(Embed $embed) : PromiseInterface<string|int, Message>
Use Channel::sendMessage
with MessageBuilder::addEmbed()
Parameters
- $embed : Embed
-
Embed to send.
Tags
Return values
PromiseInterface<string|int, Message>sendFile()
Sends a file to the channel.
public
sendFile(string $filepath[, string|null $filename = null ][, string|null $content = null ][, bool $tts = false ]) : PromiseInterface<string|int, Message>
Use Channel::sendMessage
to send files.
Parameters
- $filepath : string
-
The path to the file to be sent.
- $filename : string|null = null
-
The name to send the file as.
- $content : string|null = null
-
Message content to send with the file.
- $tts : bool = false
-
Whether to send the message with TTS.
Tags
Return values
PromiseInterface<string|int, Message>sendMessage()
public
sendMessage(MessageBuilder|string $builder) : PromiseInterface<string|int, Message>
Parameters
- $builder : MessageBuilder|string
Return values
PromiseInterface<string|int, Message>sendMessage()
Sends a message to the channel.
public
sendMessage(MessageBuilder|string $message[, bool $tts = false ][, Embed|array<string|int, mixed>|null $embed = null ][, array<string|int, mixed>|null $allowed_mentions = null ][, Message|null $replyTo = null ]) : PromiseInterface<string|int, Message>
Takes a MessageBuilder
or content of the message for the first
parameter. If the first parameter is an instance of MessageBuilder
, the
rest of the arguments are disregarded.
Parameters
- $message : MessageBuilder|string
-
The message builder that should be converted into a message, or the string content of the message.
- $tts : bool = false
-
Whether the message is TTS.
- $embed : Embed|array<string|int, mixed>|null = null
-
An embed object or array to send in the message.
- $allowed_mentions : array<string|int, mixed>|null = null
-
Allowed mentions object for the message.
- $replyTo : Message|null = null
-
Sends the message as a reply to the given message instance.
Tags
Return values
PromiseInterface<string|int, Message>serialize()
Serializes the data. Used for Serializable.
public
serialize() : string|null
Return values
string|null —A string of serialized data.
setCategory()
Change category of a channel.
public
setCategory(Channel|string|null $category[, int|null $position = null ][, string|null $reason = null ]) : PromiseInterface<string|int, self>
Parameters
- $category : Channel|string|null
-
The category channel to set it to (either a Channel part or the channel ID or null for none).
- $position : int|null = null
-
The new channel position, not relative to category.
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterface<string|int, self>setOverwrite()
Sets an overwrite to the channel.
public
setOverwrite(Part $part, Overwrite $overwrite[, string|null $reason = null ]) : PromiseInterface
Parameters
- $part : Part
-
A role or member.
- $overwrite : Overwrite
-
An overwrite object.
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterfacesetPermissions()
Sets permissions in a channel.
public
setPermissions(Part $part[, array<string|int, mixed> $allow = [] ][, array<string|int, mixed> $deny = [] ][, string|null $reason = null ]) : PromiseInterface
Parameters
- $part : Part
-
A role or member.
- $allow : array<string|int, mixed> = []
-
An array of permissions to allow.
- $deny : array<string|int, mixed> = []
-
An array of permissions to deny.
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterfacestartThread()
Starts a thread in the channel.
public
startThread(array<string|int, string>|null $options[, string|null $reason = null ][, int $_auto_archive_duration = 1440 ][, string|null $_reason = null ]) : PromiseInterface<string|int, Thread>
Parameters
- $options : array<string|int, string>|null
-
['applied_tags'] The IDs of the set of tags that have been applied to a thread in a forum channel, limited to 5.
- $reason : string|null = null
-
Reason for Audit Log.
- $_auto_archive_duration : int = 1440
- $_reason : string|null = null
Tags
Return values
PromiseInterface<string|int, Thread>undeafenMember()
Undeafens a member in the voice channel.
public
undeafenMember(Member|string $member[, string|null $reason = null ]) : PromiseInterface<string|int, Member>
Parameters
- $member : Member|string
-
The member to undeafen. (either a Member part or the member ID)
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterface<string|int, Member>unmuteMember()
Unmutes a member on a voice channel.
public
unmuteMember(Member|string $member[, string|null $reason = null ]) : PromiseInterface<string|int, Member>
Parameters
- $member : Member|string
-
The member to unmute. (either a Member part or the member ID)
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterface<string|int, Member>unpinMessage()
Removes a message from the channels pinboard.
public
unpinMessage(Message $message[, string|null $reason = null ]) : PromiseInterface
Parameters
- $message : Message
-
The message to un-pin.
- $reason : string|null = null
-
Reason for Audit Log.
Tags
Return values
PromiseInterfaceunserialize()
Unserializes some data and stores it. Used for Serializable.
public
unserialize(string $data) : void
Parameters
- $data : string
-
Some serialized data.
Tags
afterConstruct()
{@inheritDoc}
protected
afterConstruct() : void
getAvailableTagsAttribute()
Gets the available tags attribute.
protected
getAvailableTagsAttribute() : CollectionInterface|array<string|int, Tag>
Tags
Return values
CollectionInterface|array<string|int, Tag> —Available forum tags.
getDefaultReactionEmojiAttribute()
Gets the default reaction emoji attribute.
protected
getDefaultReactionEmojiAttribute() : Reaction|null
Tags
Return values
Reaction|null —Default forum reaction emoji.
getGuildAttribute()
Returns the guild attribute.
protected
getGuildAttribute() : Guild|null
Return values
Guild|null —The guild attribute.
getIsPrivateAttribute()
Gets the is_private attribute.
protected
getIsPrivateAttribute() : bool
Return values
bool —Whether the channel is private.
getLastPinTimestampAttribute()
Gets the last pinned message timestamp.
protected
getLastPinTimestampAttribute() : Carbon|null
Tags
Return values
Carbon|nullgetPermissionOverwritesAttribute()
Gets the permission overwrites attribute.
protected
getPermissionOverwritesAttribute() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —$overwrites
getRecipientAttribute()
Gets the recipient attribute.
protected
getRecipientAttribute() : User|null
Return values
User|null —The recipient.
getRecipientIdAttribute()
Gets the recipient ID attribute.
protected
getRecipientIdAttribute() : string|null
Return values
string|nullgetRecipientsAttribute()
Gets the recipients attribute.
protected
getRecipientsAttribute() : CollectionInterface
Return values
CollectionInterface —A collection of recipients.
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>setPermissionOverwritesAttribute()
Sets the permission overwrites attribute.
protected
setPermissionOverwritesAttribute(array<string|int, mixed>|null $overwrites) : void
Parameters
- $overwrites : array<string|int, mixed>|null
checkForGetMutator()
Checks if there is a get mutator present.
private
checkForGetMutator(string $key) : string|false
Parameters
- $key : string
-
The attribute name to check.
Tags
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
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
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.