Results

Namespace

Type

A GuildMember is a wrapper around a discord.User containing information on their guild membership.

Stores the member's nickname, list of roles, the time they joined, the time they started boosting the server, and a guild id.

The class also contains a handful of utility methods, such as permission helpers, kick/ban functions, and role utilities. See the Functions below for more info.

You can access the underlying user object via discord.GuildMember.user.

Hierarchy

  • GuildMember <-- You are here!

Implements

Index

Properties

Readonly guildId

guildId: Snowflake

The guild id of the guild this member instance belongs to.

Readonly joinedAt

joinedAt: string

The date and time the member joined in ISO 8601 format (YYYY-MM-DDTHH:mm:ss).

Readonly nick

nick: string | null

The member's nickname, if set.

Readonly permissions

permissions: number

Calculated permissions for the member based on the currently assigned roles.

Note: See GuildChannel.getMemberPermissions if you need channel-specific permissions.

Readonly premiumSince

premiumSince: string | null

The date and time the member started boosting (otherwise, null) in ISO 8601 format (YYYY-MM-DDTHH:mm:ss).

Readonly roles

An array of role ids this user has assigned to them.

Readonly user

user: User

A reference to the underling discord.User object.

Methods

addRole

ban

can

  • can(permission: Permissions): boolean
  • Returns true if the member can perform actions that require the specified permission. Otherwise, false is returned.

    Parameters

    Returns boolean

edit

  • edit(updateData: IGuildMemberOptions): Promise<void>
  • Updates the guild member.

    All properties of the options parameter are optional, but you must send at least one modification.

    If an error occurs, a discord.ApiError is thrown.

    Parameters

    Returns Promise<void>

getGuild

  • getGuild(): Promise<Guild>
  • Fetches an instance of the guild this member belongs to.

    Returns Promise<Guild>

getPresence

  • getPresence(): Promise<Presence>
  • Returns the latest discord.Presence data for this member.

    The presence object contains their online/offline status, custom status, and other real-time activity data.

    Returns Promise<Presence>

getUser

  • getUser(): Promise<User>
  • Fetches an instance of the user for this guild member.

    deprecated

    Simply use the discord.GuildMember.user property.

    Returns Promise<User>

kick

  • kick(): Promise<void>
  • Attempts to kick the member from the guild.

    If an error occurs, a discord.ApiError is thrown.

    Returns Promise<void>

removeRole

toMention

  • toMention(): string
  • Returns a mention string in the format of <@!id> where id is the id of this user.

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc