Invite
extends Part
in package
An invite to a Channel and Guild.
Tags
Table of Contents
- TARGET_TYPE_EMBEDDED_APPLICATION = 2
- TARGET_TYPE_STREAM = 1
- $approximate_member_count : int|null
- $approximate_presence_count : int|null
- $channel : Channel
- $channel_id : string|null
- $code : string
- $created : bool
- Is the part already created in the Discord servers?
- $created_at : Carbon|null
- $expires_at : Carbon|null
- $guild : Guild|null
- $guild_id : string|null
- $guild_scheduled_event : ScheduledEvent|null
- $invite_url : string
- $inviter : User|null
- $max_age : int|null
- $max_uses : int|null
- $scriptData : mixed
- Custom script data.
- $target_application : Application|null
- $target_type : int|null
- $target_user : User|null
- $temporary : bool|null
- $uses : 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.
- 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.
- getChannelAttribute() : Channel|null
- Returns the channel attribute.
- getChannelIdAttribute() : string
- Returns the channel id attribute.
- getCreatedAtAttribute() : Carbon|null
- Returns the created at attribute.
- getExpiresAtAttribute() : Carbon|null
- Returns the expires at attribute.
- getGuildAttribute() : Guild|null
- Returns the guild attribute.
- getGuildIdAttribute() : string|null
- Returns the guild id attribute.
- getGuildScheduledEventAttribute() : ScheduledEvent|null
- Returns the guild scheduled event on this invite.
- getIdAttribute() : string
- Returns the id attribute.
- getInviterAttribute() : User|null
- Returns the inviter attribute.
- getInviteUrlAttribute() : string
- Returns the invite URL attribute.
- getTargetApplicationAttribute() : Application|null
- Returns the target application attribute.
- getTargetUserAttribute() : User|null
- Returns the target user 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
TARGET_TYPE_EMBEDDED_APPLICATION
public
mixed
TARGET_TYPE_EMBEDDED_APPLICATION
= 2
TARGET_TYPE_STREAM
public
mixed
TARGET_TYPE_STREAM
= 1
Properties
$approximate_member_count
public
int|null
$approximate_member_count
Approximate count of total members, returned from the GET /invites/ endpoint when with_counts is true.
$approximate_presence_count
public
int|null
$approximate_presence_count
Approximate count of online members, returned from the GET /invites/ endpoint when with_counts is true.
$channel
public
Channel
$channel
The partial channel that the invite is for.
$channel_id
public
string|null
$channel_id
$code
public
string
$code
The invite code.
$created
Is the part already created in the Discord servers?
public
bool
$created
= false
Whether the part has been created.
$created_at
public
Carbon|null
$created_at
A timestamp of when the invite was created.
$expires_at
public
Carbon|null
$expires_at
The expiration date of this invite, returned from the GET /invites/ endpoint when with_expiration is true.
$guild
public
Guild|null
$guild
The partial guild that the invite is for.
$guild_id
public
string|null
$guild_id
$guild_scheduled_event
public
ScheduledEvent|null
$guild_scheduled_event
Guild scheduled event data, only included if guild_scheduled_event_id contains a valid guild scheduled event id.
$invite_url read-only
public
string
$invite_url
Returns the invite URL.
$inviter
public
User|null
$inviter
The user that created the invite.
$max_age
public
int|null
$max_age
How many seconds the invite will be alive.
$max_uses
public
int|null
$max_uses
How many times the invite can be used.
$scriptData
Custom script data.
public
mixed
$scriptData
Used for storing custom information, used by end products.
Tags
$target_application
public
Application|null
$target_application
The partial embedded application to open for this voice channel embedded application invite.
$target_type
public
int|null
$target_type
The type of target for this voice channel invite.
$target_user
public
User|null
$target_user
The user whose stream to display for this voice channel stream invite.
$temporary
public
bool|null
$temporary
Whether the invite is for temporary membership.
$uses
public
int|null
$uses
How many times the invite has been used.
$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
= [
'code',
'guild',
'channel',
'inviter',
'target_type',
'target_user',
'target_application',
'approximate_presence_count',
'approximate_member_count',
'expires_at',
'guild_scheduled_event',
// Extra metadata
'uses',
'max_uses',
'max_age',
'temporary',
'created_at',
// @internal
'guild_id',
'channel_id',
]
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
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
Return values
void —__toString()
Converts the part to a string.
public
__toString() : string
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
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 —getCreatableAttributes()
Returns the attributes needed to create.
public
getCreatableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —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()
Gets the attributes to pass to repositories.
public
getRepositoryAttributes() : array<string|int, mixed>
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
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
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
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
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 that you have been invited to.
getChannelIdAttribute()
Returns the channel id attribute.
protected
getChannelIdAttribute() : string
Return values
string —The Channel ID that you have been invited to.
getCreatedAtAttribute()
Returns the created at attribute.
protected
getCreatedAtAttribute() : Carbon|null
Tags
Return values
Carbon|null —The time that the invite was created.
getExpiresAtAttribute()
Returns the expires at attribute.
protected
getExpiresAtAttribute() : Carbon|null
Tags
Return values
Carbon|null —The time that the invite was created.
getGuildAttribute()
Returns the guild attribute.
protected
getGuildAttribute() : Guild|null
Return values
Guild|null —The Guild that you have been invited to.
getGuildIdAttribute()
Returns the guild id attribute.
protected
getGuildIdAttribute() : string|null
Return values
string|null —getGuildScheduledEventAttribute()
Returns the guild scheduled event on this invite.
protected
getGuildScheduledEventAttribute() : ScheduledEvent|null
Return values
ScheduledEvent|null —The guild scheduled event data.
getIdAttribute()
Returns the id attribute.
protected
getIdAttribute() : string
Return values
string —The id attribute.
getInviterAttribute()
Returns the inviter attribute.
protected
getInviterAttribute() : User|null
Return values
User|null —The User that invited you.
getInviteUrlAttribute()
Returns the invite URL attribute.
protected
getInviteUrlAttribute() : string
Return values
string —The URL to the invite.
getTargetApplicationAttribute()
Returns the target application attribute.
protected
getTargetApplicationAttribute() : Application|null
Return values
Application|null —The partial target application data.
getTargetUserAttribute()
Returns the target user attribute.
protected
getTargetUserAttribute() : User|null
Return values
User|null —The user whose stream to display for this voice channel stream invite.
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
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.