Member - truemedian/Discordia GitHub Wiki

Inherits UserPresence

Represents a Discord guild member. Though one user may be a member in more than one guild, each presence is represented by a different member object associated with that guild.

Methods

getColor
hasPermission
getPermissions
addRole
removeRole
hasRole
setNickname
setVoiceChannel
mute
unmute
deafen
undeafen
kick
ban
unban

Properties

roles
name
nickname
joinedAt
voiceChannel
muted
deafened
guild
highestRole

Inherited from Container
client
parent

Inherited from UserPresence
status
user
activity

Methods

:getColor( )

Returns a color object that represents the member's color as determined by its highest colored role. If the member has no colored roles, then the default color with a value of 0 is returned.

Returns: Color

:hasPermission( [ channel ], perm )

Checks whether the member has a specific permission. If channel is omitted, then only guild-level permissions are checked. This is a relatively expensive operation. If you need to check multiple permissions at once, use the getPermissions method and check the resulting object.

Name Type Optional
channel GuildChannel x
perm Permissions Resolvable

Returns: boolean

:getPermissions( [ channel ] )

Returns a permissions object that represents the member's total permissions for the guild, or for a specific channel if one is provided. If you just need to check one permission, use the hasPermission method.

Name Type Optional
channel GuildChannel x

Returns: Permissions

:addRole( id )

Adds a role to the member. If the member already has the role, then no action is taken. Note that the everyone role cannot be explicitly added.

Name Type
id Role ID Resolvable

Returns: boolean

:removeRole( id )

Removes a role from the member. If the member does not have the role, then no action is taken. Note that the everyone role cannot be removed.

Name Type
id Role ID Resolvable

Returns: boolean

:hasRole( id )

Checks whether the member has a specific role. This will return true for the guild's default role in addition to any explicitly assigned roles.

Name Type
id Role ID Resolvable

Returns: boolean

:setNickname( nick )

Sets the member's nickname. This must be between 1 and 32 characters in length. Pass nil to remove the nickname.

Name Type
nick string

Returns: boolean

:setVoiceChannel( id )

Moves the member to a new voice channel, but only if the member has an active voice connection in the current guild. Due to complexities in voice state handling, the member's voiceChannel property will update asynchronously via WebSocket; not as a result of the HTTP request.

Name Type
id Channel ID Resolvable

Returns: boolean

:mute( )

Mutes the member in its guild.

Returns: boolean

:unmute( )

Unmutes the member in its guild.

Returns: boolean

:deafen( )

Deafens the member in its guild.

Returns: boolean

:undeafen( )

Undeafens the member in its guild.

Returns: boolean

:kick( reason )

Equivalent to Member.guild:kickUser(Member.user, reason)

Name Type
reason string

Returns: boolean

:ban( reason, days )

Equivalent to Member.guild:banUser(Member.user, reason, days)

Name Type
reason string
days number

Returns: boolean

:unban( reason )

Equivalent to Member.guild:unbanUser(Member.user, reason)

Name Type
reason string

Returns: boolean

Properties

.roles

An iterable array of guild roles that the member has. This does not explicitly include the default everyone role. Object order is not guaranteed.

Type: ArrayIterable

.name

If the member has a nickname, then this will be equivalent to that nickname. Otherwise, this is equivalent to Member.user.username.

Type: string

.nickname

The member's nickname, if one is set.

Type: string|nil

.joinedAt

The date and time at which the current member joined the guild, represented as an ISO 8601 string plus microseconds when available. Member objects generated via presence updates lack this property.

Type: string|nil

.voiceChannel

The voice channel to which this member is connected in the current guild.

Type: GuildVoiceChannel|nil

.muted

Whether the member is voice muted in its guild.

Type: boolean

.deafened

Whether the member is voice deafened in its guild.

Type: boolean

.guild

The guild in which this member exists.

Type: Guild

.highestRole

The highest positioned role that the member has. If the member has no explicit roles, then this is equivalent to Member.guild.defaultRole.

Type: Role

Inherited from Container

.client

A shortcut to the client object to which this container is visible.

Type: Client

.parent

The parent object of to which this container is a child. For example, the parent of a role is the guild in which the role exists.

Type: Container|Client

Inherited from UserPresence

.status

The user's online status (online, dnd, idle, offline).

Type: string

.user

The user that this presence represents.

Type: User

.activity

The Activity that this presence represents.

Type: Activity

⚠️ **GitHub.com Fallback** ⚠️