class GuildMember extends ClientBase (View source)

Represents a guild member.

Properties

Client $client The client which initiated the instance. from ClientBase
static Client|null $serializeClient The client which will be used to unserialize. from ClientBase
Guild $guild The guild this member belongs to.
string $id The ID of the member.
string|null $nickname The nickname of the member, or null.
string|null $avatar The hash of the user's server avatar, or null.
string|null $banner The hash of the user's server banner, or null.
bool $deaf Whether the member is server deafened.
bool $mute Whether the member is server muted.
bool $selfDeaf Whether the member is locally deafened.
bool $selfMute Whether the member is locally muted.
bool $suppress Whether you suppress the member.
string|null $voiceChannelID The ID of the voice channel the member is in, or null.
string $voiceSessionID The voice session ID, or null.
int $joinedTimestamp The timestamp of when this member joined.
Collection $roles A Collection of all roles the member has, mapped by their ID. ({see \CharlotteDunois\Yasmin\Models\Role})
string $displayName The displayed name.
DateTime $joinedAt An DateTime instance of joinedTimestamp.
Permissions $permissions The permissions of the member, only taking roles into account.
Presence|null $presence The presence of the member in this guild, or null.
User|null $user The User instance of the member. This should never be null, unless you fuck up.
VoiceChannel|null $voiceChannel The voice channel the member is in, if connected to voice, or null.

Methods

__construct(Client $client, Guild $guild, array $member)

No description

__destruct()

Default destructor.

from Base
bool
__isset(string $name)

No description

from Base
mixed
__get(string $name)

No description

mixed
__call(string $name, array $args)

No description

from Base
mixed
jsonSerialize()

No description

string
serialize()

No description

void
unserialize($data)

No description

void
_patch(array $data)

No description

bool
_shouldUpdate(array $data)

No description

from Base
void
_markForDelete()

No description

from Base
mixed
__debugInfo()

No description

ExtendedPromiseInterface
addRole(Role|string $role, string $reason = '')

Adds a role to the guild member. Resolves with $this.

ExtendedPromiseInterface
addRoles(array|Collection $roles, string $reason = '')

Adds roles to the guild member. Resolves with $this.

ExtendedPromiseInterface
ban(int $days = 0, string $reason = '')

Bans the guild member.

ExtendedPromiseInterface
edit(array $options, string $reason = '')

Edits the guild member. Resolves with $this.

string|null
getGuildAvatarURL(int|null $size = 1024, string $format = '')

Get the guild avatar URL.

string
getDisplayAvatarURL(int|null $size = 1024, string $format = '')

Get the URL of the displayed avatar.

string|null
getGuildBannerURL(int|null $size = 1024, string $format = '')

Get the guild banner URL. Currently not exposed to bots.

string|null
getDisplayBannerURL(int|null $size = 1024, string $format = '')

Get the URL of the displayed banner. Currently not exposed to bots.

getColorRole()

Gets the role the member is displayed with.

int|null
getDisplayColor()

Gets the displayed color of the member.

string|null
getDisplayHexColor()

Gets the displayed color of the member as hex string.

getHighestRole()

Gets the highest role of the member.

Role|null
getHoistRole()

Gets the role the member is hoisted with.

bool
isBannable()

Whether the member can be banned by the client user.

bool
isKickable()

Whether the member can be kicked by the client user.

ExtendedPromiseInterface
kick(string $reason = '')

Kicks the guild member.

permissionsIn(GuildChannelInterface|string $channel)

Returns permissions for a member in a guild channel, taking into account roles and permission overwrites.

ExtendedPromiseInterface
removeRole(Role|string $role, string $reason = '')

Removes a role from the guild member. Resolves with $this.

ExtendedPromiseInterface
removeRoles(Collection|array $roles, string $reason = '')

Removes roles from the guild member. Resolves with $this.

ExtendedPromiseInterface
setDeaf(bool $deaf, string $reason = '')

Deafen/undeafen a guild member. Resolves with $this.

ExtendedPromiseInterface
setMute(bool $mute, string $reason = '')

Mute/unmute a guild member. Resolves with $this.

ExtendedPromiseInterface
setNickname(string $nickname, string $reason = '')

Set the nickname of the guild member. Resolves with $this.

ExtendedPromiseInterface
setRoles(Collection|Role> $roles, string $reason = '')

Sets the roles of the guild member. Resolves with $this.

ExtendedPromiseInterface
setVoiceChannel(VoiceChannel|string|null $channel, string $reason = '')

Moves the guild member to the given voice channel, if connected to voice. Resolves with $this.

void
__clone()

The internal hook for cloning.

string
__toString()

Automatically converts to a mention.

void
_setVoiceState(array $voice)

No description

Details

__construct(Client $client, Guild $guild, array $member)

Parameters

Client $client
Guild $guild
array $member

__destruct()

Default destructor.

bool __isset(string $name)

Parameters

string $name

Return Value

bool

Exceptions

Exception

mixed __get(string $name)

Parameters

string $name

Return Value

mixed

Exceptions

RuntimeException

mixed __call(string $name, array $args)

Parameters

string $name
array $args

Return Value

mixed

Exceptions

RuntimeException

mixed jsonSerialize()

Return Value

mixed

string serialize()

Return Value

string

void unserialize($data)

Parameters

$data

Return Value

void

void _patch(array $data)

Parameters

array $data

Return Value

void

bool _shouldUpdate(array $data)

Parameters

array $data

Return Value

bool

void _markForDelete()

Return Value

void

mixed __debugInfo()

Return Value

mixed

ExtendedPromiseInterface addRole(Role|string $role, string $reason = '')

Adds a role to the guild member. Resolves with $this.

Parameters

Role|string $role A role instance or role ID.
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface addRoles(array|Collection $roles, string $reason = '')

Adds roles to the guild member. Resolves with $this.

Parameters

array|Collection $roles A collection or array of Role instances or role IDs.
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface ban(int $days = 0, string $reason = '')

Bans the guild member.

Parameters

int $days Number of days of messages to delete (0-7).
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface edit(array $options, string $reason = '')

Edits the guild member. Resolves with $this.

Options are as following (only one required):

array(
  'nick' => string,
  'roles' => array|\CharlotteDunois\Collect\Collection, (of role instances or role IDs)
  'deaf' => bool,
  'mute' => bool,
  'channel' => \CharlotteDunois\Yasmin\Models\VoiceChannel|string|null (will move the member to that channel, if member is connected to voice)
)

Parameters

array $options
string $reason

Return Value

ExtendedPromiseInterface

Exceptions

InvalidArgumentException

string|null getGuildAvatarURL(int|null $size = 1024, string $format = '')

Get the guild avatar URL.

Parameters

int|null $size Any powers of 2 (16-2048).
string $format One of png, webp, jpg or gif (empty = default format).

Return Value

string|null

Exceptions

InvalidArgumentException Thrown if $size is not a power of 2

string getDisplayAvatarURL(int|null $size = 1024, string $format = '')

Get the URL of the displayed avatar.

Parameters

int|null $size Any powers of 2 (16-2048).
string $format One of png, webp, jpg or gif (empty = default format).

Return Value

string

Exceptions

InvalidArgumentException Thrown if $size is not a power of 2

string|null getGuildBannerURL(int|null $size = 1024, string $format = '')

Get the guild banner URL. Currently not exposed to bots.

Parameters

int|null $size Any powers of 2 (16-2048).
string $format One of png, webp, jpg or gif (empty = default format).

Return Value

string|null

Exceptions

InvalidArgumentException Thrown if $size is not a power of 2

string|null getDisplayBannerURL(int|null $size = 1024, string $format = '')

Get the URL of the displayed banner. Currently not exposed to bots.

Parameters

int|null $size Any powers of 2 (16-2048).
string $format One of png, webp, jpg or gif (empty = default format).

Return Value

string|null

Exceptions

InvalidArgumentException Thrown if $size is not a power of 2

Role getColorRole()

Gets the role the member is displayed with.

Return Value

Role

int|null getDisplayColor()

Gets the displayed color of the member.

Return Value

int|null

string|null getDisplayHexColor()

Gets the displayed color of the member as hex string.

Return Value

string|null

Role getHighestRole()

Gets the highest role of the member.

Return Value

Role

Role|null getHoistRole()

Gets the role the member is hoisted with.

Return Value

Role|null

bool isBannable()

Whether the member can be banned by the client user.

Return Value

bool

bool isKickable()

Whether the member can be kicked by the client user.

Return Value

bool

ExtendedPromiseInterface kick(string $reason = '')

Kicks the guild member.

Parameters

string $reason

Return Value

ExtendedPromiseInterface

Permissions permissionsIn(GuildChannelInterface|string $channel)

Returns permissions for a member in a guild channel, taking into account roles and permission overwrites.

Parameters

GuildChannelInterface|string $channel

Return Value

Permissions

Exceptions

InvalidArgumentException

ExtendedPromiseInterface removeRole(Role|string $role, string $reason = '')

Removes a role from the guild member. Resolves with $this.

Parameters

Role|string $role A role instance or role ID.
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface removeRoles(Collection|array $roles, string $reason = '')

Removes roles from the guild member. Resolves with $this.

Parameters

Collection|array $roles A collection or array of role instances (or role IDs).
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface setDeaf(bool $deaf, string $reason = '')

Deafen/undeafen a guild member. Resolves with $this.

Parameters

bool $deaf
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface setMute(bool $mute, string $reason = '')

Mute/unmute a guild member. Resolves with $this.

Parameters

bool $mute
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface setNickname(string $nickname, string $reason = '')

Set the nickname of the guild member. Resolves with $this.

Parameters

string $nickname
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface setRoles(Collection|Role> $roles, string $reason = '')

Sets the roles of the guild member. Resolves with $this.

Parameters

Collection|Role> $roles A collection or array of role instances (or role IDs).
string $reason

Return Value

ExtendedPromiseInterface

ExtendedPromiseInterface setVoiceChannel(VoiceChannel|string|null $channel, string $reason = '')

Moves the guild member to the given voice channel, if connected to voice. Resolves with $this.

If the member is connected to a voice channel and the new channel is null, then the member will be disconnected.

Parameters

VoiceChannel|string|null $channel
string $reason

Return Value

ExtendedPromiseInterface

Exceptions

InvalidArgumentException

void __clone()

The internal hook for cloning.

Return Value

void

string __toString()

Automatically converts to a mention.

Return Value

string

void _setVoiceState(array $voice)

Parameters

array $voice

Return Value

void