ChannelBuilder
extends Builder
in package
implements
JsonSerializable
Helper class used to build guild channels.
Tags
Table of Contents
Interfaces
- JsonSerializable
Properties
- $available_tags : array<string|int, mixed>|null
- $bitrate : int|null
- $default_auto_archive_duration : int|null
- $default_forum_layout : int|null
- $default_reaction_emoji : array<string|int, mixed>|null
- $default_sort_order : int|null
- $default_thread_rate_limit_per_user : int|null
- $name : string
- $nsfw : bool|null
- $parent_id : string|null
- $permission_overwrites : array<string|int, mixed>|null
- $position : int|null
- $rate_limit_per_user : int|null
- $rtc_region : string|null
- $topic : string|null
- $type : int|null
- $user_limit : int|null
- $video_quality_mode : int|null
Methods
- __get() : mixed
- Handles dynamic get calls onto the part.
- __set() : void
- Handles dynamic set calls onto the part.
- fromPart() : self
- Creates a new instance of the builder from a given Part.
- jsonSerialize() : array<string|int, mixed>
- new() : self
- setAvailableTags() : $this
- Sets the available tags for the channel.
- setBitrate() : $this
- Sets the bitrate for Voice and Stage channels.
- setDefaultAutoArchiveDuration() : $this
- Sets the default auto archive duration for Text, Announcement, Forum, and Media channels.
- setDefaultForumLayout() : self
- Sets the default forum layout for Forum channels.
- setDefaultReactionEmoji() : $this
- Sets the default reaction emoji for the channel.
- setDefaultSortOrder() : $this
- Sets the default sort order for Forum and Media channels.
- setDefaultThreadRateLimitPerUser() : $this
- Sets the default thread rate limit per user for Text, Announcement, Forum, and Media channels.
- setName() : $this
- Sets the channel name.
- setNsfw() : $this
- Sets whether the channel is NSFW for Text, Voice, Announcement, Stage, and Forum channels.
- setParentId() : $this
- Sets the parent category ID for Text, Voice, Announcement, Stage, Forum, and Media channels.
- setPermissionOverwrites() : $this
- Sets the permission overwrites for the channel.
- setPosition() : $this
- Sets the position of the channel.
- setRateLimitPerUser() : $this
- Sets the rate limit per user for Text, Voice, Stage, Forum, and Media channels.
- setRtcRegion() : $this
- Sets the RTC region for Voice and Stage channels.
- setTopic() : $this
- Sets the channel topic for Text, Announcement, Forum, and Media channels.
- setType() : $this
- Sets the channel type.
- setUserLimit() : $this
- Sets the user limit for Voice and Stage channels.
- setVideoQualityMode() : $this
- Sets the video quality mode for Voice and Stage channels.
- checkForGetMutator() : string|false
- Checks if there is a get mutator present.
- checkForSetMutator() : string|false
- Checks if there is a set mutator present.
- getProperty() : mixed
- Gets a property on the parent part.
- setProperty() : void
- Sets an property on the parent part.
- studly() : string
- Converts a string to studlyCase.
Properties
$available_tags
protected
array<string|int, mixed>|null
$available_tags
$bitrate
protected
int|null
$bitrate
$default_auto_archive_duration
protected
int|null
$default_auto_archive_duration
$default_forum_layout
protected
int|null
$default_forum_layout
$default_reaction_emoji
protected
array<string|int, mixed>|null
$default_reaction_emoji
$default_sort_order
protected
int|null
$default_sort_order
$default_thread_rate_limit_per_user
protected
int|null
$default_thread_rate_limit_per_user
$name
protected
string
$name
$nsfw
protected
bool|null
$nsfw
$parent_id
protected
string|null
$parent_id
$permission_overwrites
protected
array<string|int, mixed>|null
$permission_overwrites
$position
protected
int|null
$position
$rate_limit_per_user
protected
int|null
$rate_limit_per_user
$rtc_region
protected
string|null
$rtc_region
$topic
protected
string|null
$topic
$type
protected
int|null
$type
$user_limit
protected
int|null
$user_limit
$video_quality_mode
protected
int|null
$video_quality_mode
Methods
__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.
__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
fromPart()
Creates a new instance of the builder from a given Part.
public
static fromPart(Part $part) : self
Parameters
- $part : Part
Return values
selfjsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>new()
public
static new(string $name) : self
Parameters
- $name : string
Return values
selfsetAvailableTags()
Sets the available tags for the channel.
public
setAvailableTags([array<string|int, Tag>|null $tags = null ]) : $this
Parameters
- $tags : array<string|int, Tag>|null = null
Return values
$thissetBitrate()
Sets the bitrate for Voice and Stage channels.
public
setBitrate([int|null $bitrate = null ]) : $this
Parameters
- $bitrate : int|null = null
-
The bitrate in bits (minimum 8000).
Return values
$thissetDefaultAutoArchiveDuration()
Sets the default auto archive duration for Text, Announcement, Forum, and Media channels.
public
setDefaultAutoArchiveDuration([int|null $duration = null ]) : $this
Parameters
- $duration : int|null = null
-
The default auto archive duration in minutes. Can be 60, 1440, 4320, or 10080.
Return values
$thissetDefaultForumLayout()
Sets the default forum layout for Forum channels.
public
setDefaultForumLayout([int|null $layout = null ]) : self
Parameters
- $layout : int|null = null
-
The default forum layout. 0 for Not Set, 1 for List View, 2 for Gallery View.
Return values
selfsetDefaultReactionEmoji()
Sets the default reaction emoji for the channel.
public
setDefaultReactionEmoji([Emoji|array<string|int, mixed>|null $emoji = null ]) : $this
Parameters
- $emoji : Emoji|array<string|int, mixed>|null = null
Return values
$thissetDefaultSortOrder()
Sets the default sort order for Forum and Media channels.
public
setDefaultSortOrder([int|null $order = null ]) : $this
Parameters
- $order : int|null = null
-
The default sort order. 0 for Latest Activity, 1 for Creation Date.
Return values
$thissetDefaultThreadRateLimitPerUser()
Sets the default thread rate limit per user for Text, Announcement, Forum, and Media channels.
public
setDefaultThreadRateLimitPerUser([int|null $rate_limit = null ]) : $this
Parameters
- $rate_limit : int|null = null
-
The default thread rate limit per user in seconds (0-21600).
Return values
$thissetName()
Sets the channel name.
public
setName(string $name) : $this
Parameters
- $name : string
-
The channel name (1-100 characters).
Return values
$thissetNsfw()
Sets whether the channel is NSFW for Text, Voice, Announcement, Stage, and Forum channels.
public
setNsfw([bool|null $nsfw = null ]) : $this
Parameters
- $nsfw : bool|null = null
-
Whether the channel is NSFW.
Return values
$thissetParentId()
Sets the parent category ID for Text, Voice, Announcement, Stage, Forum, and Media channels.
public
setParentId([Channel|string|null $parent_id = null ]) : $this
Parameters
- $parent_id : Channel|string|null = null
-
The parent category ID.
Return values
$thissetPermissionOverwrites()
Sets the permission overwrites for the channel.
public
setPermissionOverwrites([array<string|int, Overwrite>|null $overwrites = null ]) : $this
Parameters
- $overwrites : array<string|int, Overwrite>|null = null
-
An array of permission overwrite arrays.
Return values
$thissetPosition()
Sets the position of the channel.
public
setPosition([int|null $position = null ]) : $this
Parameters
- $position : int|null = null
-
The position of the channel.
Return values
$thissetRateLimitPerUser()
Sets the rate limit per user for Text, Voice, Stage, Forum, and Media channels.
public
setRateLimitPerUser([int|null $rate_limit = null ]) : $this
Parameters
- $rate_limit : int|null = null
-
The rate limit per user in seconds (0-21600).
Return values
$thissetRtcRegion()
Sets the RTC region for Voice and Stage channels.
public
setRtcRegion([Region|string|null $rtc_region = null ]) : $this
Parameters
- $rtc_region : Region|string|null = null
-
The RTC region ID, or null for automatic.
Return values
$thissetTopic()
Sets the channel topic for Text, Announcement, Forum, and Media channels.
public
setTopic([string|null $topic = null ]) : $this
Parameters
- $topic : string|null = null
-
The channel topic (0-1024 characters).
Return values
$thissetType()
Sets the channel type.
public
setType(int $type) : $this
Parameters
- $type : int
-
The channel type. Must be one of the TYPE_* constants on the Channel class.
Return values
$thissetUserLimit()
Sets the user limit for Voice and Stage channels.
public
setUserLimit([int|null $user_limit = null ]) : $this
Parameters
- $user_limit : int|null = null
-
The user limit (0-99 for Voice, 0-10,000 for Stage). 0 is unlimited.
Return values
$thissetVideoQualityMode()
Sets the video quality mode for Voice and Stage channels.
public
setVideoQualityMode([int|null $mode = null ]) : $this
Parameters
- $mode : int|null = null
-
The video quality mode. 1 for Discord chooses the quality for optimal performance, 2 for full 720p.
Return values
$thischeckForGetMutator()
Checks if there is a get mutator present.
private
checkForGetMutator(string $key) : string|false
Parameters
- $key : string
-
The property name to check.
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 property name to check.
Return values
string|false —Either a string if it is a method or false.
getProperty()
Gets a property on the parent part.
private
getProperty(string $key) : mixed
Parameters
- $key : string
-
The name of the property.
Tags
Return values
mixed —Either the property if it exists or void.
setProperty()
Sets an property on the parent part.
private
setProperty(string $key, mixed $value) : void
Parameters
- $key : string
-
The name of the property.
- $value : mixed
-
The value of the property.
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. This method is private static as we may move it outside this class in future.
Parameters
- $string : string
-
The string to convert.