DiscordPHP Documentation

ScheduledEvent extends Part
in package

A representation of a scheduled event in a guild.

Tags
link
https://discord.com/developers/docs/resources/guild-scheduled-event
since
7.0.0

Table of Contents

ENTITY_TYPE_EXTERNAL  = 3
ENTITY_TYPE_STAGE_INSTANCE  = 1
ENTITY_TYPE_VOICE  = 2
PRIVACY_LEVEL_GUILD_ONLY  = 2
STATUS_ACTIVE  = 2
STATUS_CANCELED  = 4
STATUS_COMPLETED  = 3
STATUS_SCHEDULED  = 1
$channel  : Channel|null
$channel_id  : Array|null
$created  : bool
Is the part already created in the Discord servers?
$creator  : User|null
$creator_id  : Array|null
$description  : Array|null
$entity_id  : string|null
$entity_metadata  : object|null
$entity_type  : int
$guild  : Guild|null
$guild_id  : string
$id  : string
$image  : Array|null
$image_hash  : string|null
$name  : string
$privacy_level  : int
$scheduled_end_time  : Carbon|null
$scheduled_start_time  : Carbon
$scriptData  : mixed
Custom script data.
$status  : int
$user_count  : int|null
$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.
__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
Converts the part to a string.
__unserialize()  : void
fetch()  : ExtendedPromiseInterface<string|int, self>
Fetches any missing information about the part from Discord's servers.
fill()  : void
Fills the parts attributes from an array.
getCreatableAttributes()  : array<string|int, mixed>
Returns the attributes needed to create.
getImageAttribute()  : string|null
Returns the image attribute.
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.
getUsers()  : ExtendedPromiseInterface
Get a list of guild scheduled event users subscribed to a guild scheduled event.
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.
getChannelAttribute()  : Channel|null
Returns the channel attribute.
getCreatorAttribute()  : User|null
Gets the user that created the scheduled event.
getGuildAttribute()  : Guild|null
Returns the guild attribute.
getImageHashAttribute()  : string|null
Returns the image hash.
getScheduledEndTimeAttribute()  : Carbon|null
Returns the created at attribute.
getScheduledStartTimeAttribute()  : Carbon
Returns the created at attribute.
checkForMutator()  : string|false
Checks if there is a 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

ENTITY_TYPE_STAGE_INSTANCE

public mixed ENTITY_TYPE_STAGE_INSTANCE = 1

PRIVACY_LEVEL_GUILD_ONLY

public mixed PRIVACY_LEVEL_GUILD_ONLY = 2

Properties

$channel read-only

public Channel|null $channel

The channel in which the scheduled event will be hosted, or null.

$channel_id

public Array|null $channel_id

The channel id in which the scheduled event will be hosted, or null if scheduled entity type is EXTERNAL.

$created

Is the part already created in the Discord servers?

public bool $created = false

Whether the part has been created.

$creator_id

public Array|null $creator_id

The id of the user that created the scheduled event.

$description

public Array|null $description

The description of the scheduled event (1-1000 characters).

$entity_id

public string|null $entity_id

The id of an entity associated with a guild scheduled event.

$entity_metadata

public object|null $entity_metadata

Additional metadata for the guild scheduled event.

$entity_type

public int $entity_type

The type of the scheduled event.

$guild_id

public string $guild_id

The guild id which the scheduled event belongs to.

$image

public Array|null $image

The cover image URL of the scheduled event.

$image_hash read-only

public string|null $image_hash

The cover image hash of the scheduled event.

$name

public string $name

The name of the scheduled event (1-100 characters).

$privacy_level

public int $privacy_level

The privacy level of the scheduled event.

$scheduled_end_time

public Carbon|null $scheduled_end_time

The time the scheduled event will end, required if entity_type is EXTERNAL.

$scheduled_start_time

public Carbon $scheduled_start_time

The time the scheduled event will start.

$scriptData

Custom script data.

public mixed $scriptData

Used for storing custom information, used by end products.

Tags
deprecated
10.0.0

Relying on this variable with dynamic caching is discouraged.

$user_count

public int|null $user_count

The number of users subscribed to the scheduled event.

$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 = ['id', 'guild_id', 'channel_id', 'creator_id', 'name', 'description', 'image', 'scheduled_start_time', 'scheduled_end_time', 'privacy_level', 'status', 'entity_type', 'entity_id', 'entity_metadata', 'creator', 'user_count']

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()

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.

Return values
mixed

__debugInfo()

Handles debug calls from var_dump and similar functions.

public __debugInfo() : 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.

__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.

Return values
void

__toString()

Converts the part to a string.

public __toString() : string
Tags
throws
Exception
see
Part::getPublicAttributes()

This function encodes getPublicAttributes into JSON.

Return values
string

A JSON string of attributes.

__unserialize()

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

fetch()

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

public fetch() : ExtendedPromiseInterface<string|int, self>
Tags
throws
RuntimeException

The part is not fetchable.

Return values
ExtendedPromiseInterface<string|int, self>

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.

Return values
void

getImageAttribute()

Returns the image attribute.

public getImageAttribute([string|null $format = null ][, int $size = 1024 ]) : string|null
Parameters
$format : string|null = null

The image format.

$size : int = 1024

The size of the image.

Return values
string|null

The URL to the guild scheduled event cover image if exists.

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>
Return values
array<string|int, mixed>

Attributes.

getUsers()

Get a list of guild scheduled event users subscribed to a guild scheduled event.

public getUsers(array<string|int, mixed> $options) : ExtendedPromiseInterface

Returns a list of guild scheduled event user objects on success. Guild member data, if it exists, is included if the with_member query parameter is set.

Parameters
$options : array<string|int, mixed>
Tags
link
https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users
throws
RangeException
Return values
ExtendedPromiseInterface

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.

Return values
mixed

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.

Return values
void

offsetUnset()

Unsets an attribute via key. Used for ArrayAccess.

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

The attribute key.

Return values
void

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.

Return values
void

afterConstruct()

Called after the part has been constructed.

protected afterConstruct() : void
Return values
void

getChannelAttribute()

Returns the channel attribute.

protected getChannelAttribute() : Channel|null
Return values
Channel|null

The channel in which the scheduled event will be hosted, or null.

getCreatorAttribute()

Gets the user that created the scheduled event.

protected getCreatorAttribute() : User|null
Return values
User|null

The user that created the scheduled event.

getGuildAttribute()

Returns the guild attribute.

protected getGuildAttribute() : Guild|null
Return values
Guild|null

The guild which the scheduled event belongs to.

getImageHashAttribute()

Returns the image hash.

protected getImageHashAttribute() : string|null
Return values
string|null

The guild scheduled event cover image hash if exists.

getScheduledEndTimeAttribute()

Returns the created at attribute.

protected getScheduledEndTimeAttribute() : Carbon|null
Tags
throws
Exception
Return values
Carbon|null

The time the scheduled event will end, required if entity_type is EXTERNAL.

getScheduledStartTimeAttribute()

Returns the created at attribute.

protected getScheduledStartTimeAttribute() : Carbon
Tags
throws
Exception
Return values
Carbon

The time the scheduled event will start.

checkForMutator()

Checks if there is a mutator present.

private checkForMutator(string $key, string $type) : string|false
Parameters
$key : string

The attribute name to check.

$type : string

Either get or set.

Return values
string|false

Either a string if it is callable 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.

Return values
void

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

Search results