-
Notifications
You must be signed in to change notification settings - Fork 143
Member
extends 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. Note that any method or property that exists for the User class is also available in the Member class.
Instances of this class should not be constructed by users.
Properties Inherited From UserPresence
Name | Type | Description |
---|---|---|
activity | Activity/nil | The Activity that this presence represents. |
client | Client | A shortcut to the client object to which this container is visible. |
desktopStatus | string | The user's desktop status (online, dnd, idle, offline). |
mobileStatus | string | The user's mobile status (online, dnd, idle, offline). |
parent | Container/Client | 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. |
status | string | The user's overall status (online, dnd, idle, offline). |
user | User | The user that this presence represents. |
webStatus | string | The user's web status (online, dnd, idle, offline). |
Name | Type | Description |
---|---|---|
deafened | boolean | Whether the member is voice deafened in its guild. |
guild | Guild | The guild in which this member exists. |
highestRole | Role | The highest positioned role that the member has. If the member has no explicit roles, then this is equivalent to Member.guild.defaultRole . |
joinedAt | string/nil | 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. |
muted | boolean | Whether the member is voice muted in its guild. |
name | string | If the member has a nickname, then this will be equivalent to that nickname. Otherwise, this is equivalent to Member.user.name . |
nickname | string/nil | The member's nickname, if one is set. |
premiumSince | string/nil | The date and time at which the current member boosted the guild, represented as an ISO 8601 string plus microseconds when available. |
roles | ArrayIterable | An iterable array of guild roles that the member has. This does not explicitly include the default everyone role. Object order is not guaranteed. |
timedOut | boolean | Whether the member is timed out in its guild. |
timedOutUntil | string/nil | The raw communication_disabled_until member property. Note this may be provided even when the member's time out have expired. |
voiceChannel | GuildVoiceChannel/nil | The voice channel to which this member is connected in the current guild. |
Methods Inherited From UserPresence
Defines the behavior of the ==
operator. Allows containers to be directly compared according to their type and __hash
return values.
Returns: boolean
Returns UserPresence.user.id
Returns: string
Defines the behavior of the tostring
function. All containers follow the format ClassName: hash
.
Returns: string
Parameter | Type |
---|---|
id | Role-ID-Resolvable |
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.
This method may make an HTTP request.
Returns: boolean
Parameter | Type | Optional |
---|---|---|
reason | string | ✔ |
days | number | ✔ |
Equivalent to Member.guild:banUser(Member.user, reason, days)
This method always makes an HTTP request.
Returns: boolean
Deafens the member in its guild.
This method always makes an HTTP request.
Returns: boolean
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.
This method only operates on data in memory.
Returns: Color
Parameter | Type | Optional |
---|---|---|
channel | GuildChannel | ✔ |
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.
This method only operates on data in memory.
Returns: Permissions
Parameter | Type | Optional |
---|---|---|
channel | GuildChannel | ✔ |
perm | Permissions-Resolvable |
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.
This method only operates on data in memory.
Returns: boolean
Parameter | Type |
---|---|
id | Role-ID-Resolvable |
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.
This method only operates on data in memory.
Returns: boolean
Parameter | Type | Optional |
---|---|---|
reason | string | ✔ |
Equivalent to Member.guild:kickUser(Member.user, reason)
This method always makes an HTTP request.
Returns: boolean
Mutes the member in its guild.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
id | Role-ID-Resolvable |
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.
This method may make an HTTP request.
Returns: boolean
Removes the timeout of the member.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
nick | string |
Sets the member's nickname. This must be between 1 and 32 characters in length. Pass nil
to remove the nickname.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
id | Channel-ID-Resolvable |
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. Not supplying an ID will result in the member being disconnected from the channel.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
duration | Time/number |
Sets a timeout for a guild member. duration
is either Time
object or a number
of seconds representing how long the timeout lasts. To set an expiration date, use timeoutUntil
instead.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
date | Date/number |
Sets a timeout for a guild member. date
is either Date
object or a UNIX epoch in seconds at which the member's timeout ends. To set a duration, use timeoutFor
instead.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type | Optional |
---|---|---|
reason | string | ✔ |
Equivalent to Member.guild:unbanUser(Member.user, reason)
This method always makes an HTTP request.
Returns: boolean
Undeafens the member in its guild.
This method always makes an HTTP request.
Returns: boolean
Unmutes the member in its guild.
This method always makes an HTTP request.
Returns: boolean