Documentation

Member extends Part

A member is a relationship between a user and a guild. It contains user-to-guild specific data like roles.

Table of Contents

$activities  : Collection|array<string|int, Activity>
$client_status  : object
$created  : bool
Is the part already created in the Discord servers?
$deaf  : bool
$discriminator  : string
$game  : Activity
$guild  : Guild
$guild_id  : string
$id  : string
$joined_at  : Carbon|null
$mute  : bool
$nick  : string|null
$premium_since  : Carbon|null
$roles  : Collection|array<string|int, Role>
$scriptData  : mixed
Custom script data.
$status  : string
$user  : User
$username  : string
$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.
$fillAfterSave  : bool
Should we fill the part after saving?
$hidden  : array<string|int, mixed>
Attributes that are hidden from debug info.
$http  : Http
The HTTP client.
$regex  : string
The regex pattern to replace variables with.
$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.
__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.
__set()  : mixed
Handles dynamic set calls onto the part.
__toString()  : string
Returns a formatted mention.
addRole()  : ExtendedPromiseInterface
Adds a role to the member.
ban()  : ExtendedPromiseInterface
Bans the member. Alias for `$guild->bans->ban()`.
fetch()  : ExtendedPromiseInterface<string|int, static>
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.
getPermissions()  : RolePermission
Gets the total permissions of the member.
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.
moveMember()  : ExtendedPromiseInterface
Moves the member to another 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()  : mixed
Sets an attribute via key. Used for ArrayAccess.
offsetUnset()  : mixed
Unsets an attribute via key. Used for ArrayAccess.
removeRole()  : ExtendedPromiseInterface
Removes a role from the user.
serialize()  : string
Serializes the data. Used for Serializable.
setNickname()  : ExtendedPromiseInterface
Sets the nickname of the member.
unserialize()  : mixed
Unserializes some data and stores it. Used for Serializable.
afterConstruct()  : void
Called after the part has been constructed.
getActivitiesAttribute()  : Collection|array<string|int, Activity>
Gets the activities attribute.
getDiscriminatorAttribute()  : string
Returns the discriminator attribute.
getGameAttribute()  : Activity
Gets the game attribute.
getGuildAttribute()  : null|Guild
Returns the guild attribute.
getIdAttribute()  : string
Returns the id attribute.
getJoinedAtAttribute()  : Carbon|null
Returns the joined at attribute.
getPremiumSinceAttribute()  : Carbon|null
Returns the premium since attribute.
getRolesAttribute()  : Collection
Returns the roles attribute.
getUserAttribute()  : User
Returns the user attribute.
getUsernameAttribute()  : string
Returns the username 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.

Properties

$client_status

public object $client_status

Current client status

$created

Is the part already created in the Discord servers?

public bool $created = false

$deaf

public bool $deaf

Whether the member is deaf.

$discriminator

public string $discriminator

The discriminator of the member.

$guild

public Guild $guild

The guild that the member belongs to.

$guild_id

public string $guild_id

The unique identifier of the guild that the member belongs to.

$id

public string $id

The unique identifier of the member.

$joined_at

public Carbon|null $joined_at

A timestamp of when the member joined the guild.

$mute

public bool $mute

Whether the member is mute.

$nick

public string|null $nick

The nickname of the member.

$premium_since

public Carbon|null $premium_since

When the user started boosting the server.

$scriptData

Custom script data.

public mixed $scriptData

Used for storing custom information, used by end products.

$status

public string $status

The status of the member.

$username

public string $username

The username of the member.

$attributes

The parts attributes.

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

$fillable

The parts fillable attributes.

protected array<string|int, mixed> $fillable = ['id', 'user', 'roles', 'deaf', 'mute', 'joined_at', 'guild_id', 'status', 'nick', 'premium_since', 'activities', 'client_status']

$fillAfterSave

Should we fill the part after saving?

protected bool $fillAfterSave = false

$hidden

Attributes that are hidden from debug info.

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

$http

The HTTP client.

protected Http $http

$regex

The regex pattern to replace variables with.

protected string $regex = '/:([a-z_]+)/'

$repositories

An array of repositories that can exist in a part.

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

$repositories_cache

An array of repositories.

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

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
self::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
self::getAttribute()

This function forwards onto getAttribute.

Return values
mixed

The value of the attribute.

__set()

Handles dynamic set calls onto the part.

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

The attributes key.

$value : mixed

The attributes value.

Tags
see
self::setAttribute()

This function forwards onto setAttribute.

Return values
mixed

__toString()

Returns a formatted mention.

public __toString() : string
Return values
string

addRole()

Adds a role to the member.

public addRole(Role|string $role) : ExtendedPromiseInterface
Parameters
$role : Role|string

The role to add to the member.

Return values
ExtendedPromiseInterface

ban()

Bans the member. Alias for `$guild->bans->ban()`.

public ban([int|null $daysToDeleteMessages = null ][, string|null $reason = null ]) : ExtendedPromiseInterface
Parameters
$daysToDeleteMessages : int|null = null

The amount of days to delete messages from.

$reason : string|null = null
Tags
throws
Exception
Return values
ExtendedPromiseInterface

fetch()

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

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

The part is not fetchable.

Return values
ExtendedPromiseInterface<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.

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

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
self::getPublicAttributes()

This function forwards onto getPublicAttributes.

Return values
array<string|int, mixed>

An array of public attributes.

moveMember()

Moves the member to another voice channel.

public moveMember(Channel|string $channel) : ExtendedPromiseInterface
Parameters
$channel : Channel|string

The channel to move the member to.

Return values
ExtendedPromiseInterface

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
self::getAttribute()

This function forwards onto getAttribute.

Return values
mixed

offsetSet()

Sets an attribute via key. Used for ArrayAccess.

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

The attribute key.

$value : mixed

The attribute value.

Tags
see
self::setAttribute()

This function forwards onto setAttribute.

Return values
mixed

offsetUnset()

Unsets an attribute via key. Used for ArrayAccess.

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

The attribute key.

Return values
mixed

removeRole()

Removes a role from the user.

public removeRole(Role|string $role) : ExtendedPromiseInterface
Parameters
$role : Role|string

The role to remove from the member.

Return values
ExtendedPromiseInterface

serialize()

Serializes the data. Used for Serializable.

public serialize() : string
Return values
string

A string of serialized data.

setNickname()

Sets the nickname of the member.

public setNickname([string|null $nick = null ]) : ExtendedPromiseInterface
Parameters
$nick : string|null = null

The nickname of the member.

Return values
ExtendedPromiseInterface

unserialize()

Unserializes some data and stores it. Used for Serializable.

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

Some serialized data.

Tags
see
self::setAttribute()

The unserialized data is stored with setAttribute.

Return values
mixed

afterConstruct()

Called after the part has been constructed.

protected afterConstruct() : void
Return values
void

getDiscriminatorAttribute()

Returns the discriminator attribute.

protected getDiscriminatorAttribute() : string
Return values
string

The discriminator of the member.

getGameAttribute()

Gets the game attribute.

protected getGameAttribute() : Activity

Polyfill for the first activity.

Return values
Activity

getGuildAttribute()

Returns the guild attribute.

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

The guild.

getIdAttribute()

Returns the id attribute.

protected getIdAttribute() : string
Return values
string

The user ID of the member.

getJoinedAtAttribute()

Returns the joined at attribute.

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

The timestamp from when the member joined.

getPremiumSinceAttribute()

Returns the premium since attribute.

protected getPremiumSinceAttribute() : Carbon|null
Return values
Carbon|null

getRolesAttribute()

Returns the roles attribute.

protected getRolesAttribute() : Collection
Tags
throws
Exception
Return values
Collection

A collection of roles the member is in.

getUserAttribute()

Returns the user attribute.

protected getUserAttribute() : User
Tags
throws
Exception
Return values
User

The user that owns the member.

getUsernameAttribute()

Returns the username attribute.

protected getUsernameAttribute() : string
Return values
string

The username of the member.

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

Search results