Skip to content

GuildMember

classe · Source

Represents a member of a guild on Discord.

Extends: BaseImplements: TextBasedChannel

Properties

guild

guild: Guild

The guild that this member is part of Source

joinedTimestamp

nullable

joinedTimestamp: number

The timestamp the member joined the guild at Source

premiumSinceTimestamp

nullable

premiumSinceTimestamp: number

The last timestamp this member started boosting the guild Source

nickname

nullable

nickname: string

The nickname of this member, if they have one Source

pending

pending: boolean

Whether this member has yet to pass the guild's membership gate Source

communicationDisabledUntilTimestamp

nullable

communicationDisabledUntilTimestamp: number

The timestamp this member's timeout will be removed Source

_roles

private

_roles: Array<Snowflake>

The role ids of the member Source

user

nullable

user: User

The user that this guild member instance represents Source

avatar

nullable

avatar: string

The guild member's avatar hash Source

nullable

banner: string

The guild member's banner hash. Source

flags

flags: Readonly<GuildMemberFlags>

The flags of this member Source

avatarDecorationData

nullable

avatarDecorationData: AvatarDecorationData

The member avatar decoration's data Source

collectibles

nullable

collectibles: Collectibles

The member's collectibles Source

deleted

deprecated

deleted: boolean

Whether or not the structure has been deleted Source

partial

readonly

partial: boolean

Whether this GuildMember is a partial Source

roles

readonly

roles: GuildMemberRoleManager

A manager for the roles belonging to this member Source

voice

readonly

voice: VoiceState

The voice state of this member Source

joinedAt

readonly · nullable

joinedAt: Date

The time this member joined the guild Source

communicationDisabledUntil

readonly · nullable

communicationDisabledUntil: Date

The time this member's timeout will be removed Source

premiumSince

readonly · nullable

premiumSince: Date

The last time this member started boosting the guild Source

presence

readonly · nullable

presence: Presence

The presence of this guild member Source

displayColor

readonly

displayColor: number

The displayed color of this member in base 10 Source

displayHexColor

readonly

displayHexColor: string

The displayed color of this member in hexadecimal Source

id

readonly

id: Snowflake

The member's id Source

displayName

readonly · nullable

displayName: string

The nickname of this member, or their user display name if they don't have one Source

permissions

readonly

permissions: Readonly<Permissions>

The overall set of permissions for this member, taking only roles and owner status into account Source

manageable

readonly

manageable: boolean

Whether the client user is above this user in the hierarchy, according to role position and guild ownership. This is a prerequisite for many moderative actions. Source

kickable

readonly

kickable: boolean

Whether this member is kickable by the client user Source

bannable

readonly

bannable: boolean

Whether this member is bannable by the client user Source

moderatable

readonly

moderatable: boolean

Whether this member is moderatable by the client user Source

client

readonly

client: Client

The client that instantiated this Source

Methods

avatarDecorationURL

avatarDecorationURL(): string

A link to the user's avatar decoration. Returns: stringSource

avatarURL

avatarURL(options?: ImageURLOptions): string

A link to the member's guild avatar. Parameters

NameTypeDescription
options?ImageURLOptionsOptions for the Image URL Default: {}.

Returns: stringSource

bannerURL

bannerURL(options?: ImageURLOptions): string

A link to the member's banner. Parameters

NameTypeDescription
options?ImageURLOptionsOptions for the banner URL Default: {}.

Returns: stringSource

displayAvatarDecorationURL

displayAvatarDecorationURL(): string

A link to the member's guild avatar decoration if they have one. Otherwise, a link to their User#avatarDecorationURL will be returned. Returns: stringSource

displayAvatarURL

displayAvatarURL(options?: ImageURLOptions): string

A link to the member's guild avatar if they have one. Otherwise, a link to their User#displayAvatarURL will be returned. Parameters

NameTypeDescription
options?ImageURLOptionsOptions for the Image URL Default: {}.

Returns: stringSource

displayBannerURL

displayBannerURL(options?: ImageURLOptions): string

A link to the member's guild banner if they have one. Otherwise, a link to their User#bannerURL will be returned. Parameters

NameTypeDescription
options?ImageURLOptionsOptions for the image URL Default: {}.

Returns: stringSource

isCommunicationDisabled

isCommunicationDisabled(): boolean

Whether this member is currently timed out Returns: booleanSource

permissionsIn

permissionsIn(channel: GuildChannelResolvable): Readonly<Permissions>

Returns channel.permissionsFor(guildMember). Returns permissions for a member in a guild channel, taking into account roles and permission overwrites. Parameters

NameTypeDescription
channelGuildChannelResolvableThe guild channel to use as context

Returns: Readonly<Permissions>Source

edit

edit(data: GuildMemberEditData, reason?: string): Promise<GuildMember>

Edits this member. Parameters

NameTypeDescription
dataGuildMemberEditDataThe data to edit the member with
reason?stringReason for editing this user

Returns: Promise<GuildMember>Source

setNickname

setNickname(nick: string, reason?: string): Promise<GuildMember>

Sets the nickname for this member. Parameters

NameTypeDescription
nickstringThe nickname for the guild member, or null if you want to reset their nickname
reason?stringReason for setting the nickname

Returns: Promise<GuildMember>

js
// Set a nickname for a guild member
guildMember.setNickname('cool nickname', 'Needed a new nickname')
  .then(member => console.log(`Set nickname of ${member.user.username}`))
  .catch(console.error);
js
// Remove a nickname for a guild member
guildMember.setNickname(null, 'No nicknames allowed!')
  .then(member => console.log(`Removed nickname for ${member.user.username}`))
  .catch(console.error);

Source

setFlags

setFlags(flags: GuildMemberFlagsResolvable, reason?: string): Promise<GuildMember>

Sets the flags for this member. Parameters

NameTypeDescription
flagsGuildMemberFlagsResolvableThe flags to set
reason?stringReason for setting the flags

Returns: Promise<GuildMember>Source

createDM

createDM(force?: boolean): Promise<DMChannel>

Creates a DM channel between the client and this member. Parameters

NameTypeDescription
force?booleanWhether to skip the cache check and request the API Default: false.

Returns: Promise<DMChannel>Source

deleteDM

deleteDM(): Promise<DMChannel>

Deletes any DMs with this member. Returns: Promise<DMChannel>Source

kick

kick(reason?: string): Promise<GuildMember>

Kicks this member from the guild. Parameters

NameTypeDescription
reason?stringReason for kicking user

Returns: Promise<GuildMember>Source

ban

ban(options?: BanOptions): Promise<GuildMember>

Bans this guild member. Parameters

NameTypeDescription
options?BanOptionsOptions for the ban

Returns: Promise<GuildMember>

js
// Ban a guild member, deleting a week's worth of messages
guildMember.ban({ deleteMessageSeconds: 60 * 60 * 24 * 7, reason: 'They deserved it' })
  .then(console.log)
  .catch(console.error);

Source

disableCommunicationUntil

disableCommunicationUntil(communicationDisabledUntil: DateResolvable | null, reason?: string): Promise<GuildMember>

Times this guild member out. Parameters

NameTypeDescription
communicationDisabledUntilDateResolvable | nullThe date or timestamp
for the member's communication to be disabled until. Provide null to remove the timeout.
reason?stringThe reason for this timeout.

Returns: Promise<GuildMember>

js
// Time a guild member out for 5 minutes
guildMember.disableCommunicationUntil(Date.now() + (5 * 60 * 1000), 'They deserved it')
  .then(console.log)
  .catch(console.error);
js
// Remove the timeout of a guild member
guildMember.disableCommunicationUntil(null)
  .then(member => console.log(`Removed timeout for ${member.displayName}`))
  .catch(console.error);

Source

timeout

timeout(timeout: number | null, reason?: string): Promise<GuildMember>

Times this guild member out. Parameters

NameTypeDescription
timeoutnumber | nullThe time in milliseconds
for the member's communication to be disabled until. Provide null to remove the timeout.
reason?stringThe reason for this timeout.

Returns: Promise<GuildMember>

js
// Time a guild member out for 5 minutes
guildMember.timeout(5 * 60 * 1000, 'They deserved it')
  .then(console.log)
  .catch(console.error);

Source

fetch

fetch(force?: boolean): Promise<GuildMember>

Fetches this GuildMember. Parameters

NameTypeDescription
force?booleanWhether to skip the cache check and request the API Default: true.

Returns: Promise<GuildMember>Source

equals

equals(member: GuildMember): boolean

Whether this guild member equals another guild member. It compares all properties, so for most comparison it is advisable to just compare member.id === member2.id as it is significantly faster and is often what most users need. Parameters

NameTypeDescription
memberGuildMemberThe member to compare with

Returns: booleanSource

toString

toString(): string

When concatenated with a string, this automatically returns the user's mention instead of the GuildMember object. Returns: string

js
// Logs: Hello from <@123456789012345678>!
console.log(`Hello from ${member}!`);

Source

setAvatar

setAvatar(avatar: BufferResolvable | Base64Resolvable): Promise<GuildMember>

Sets the guild avatar of the logged in client. Parameters

NameTypeDescription
avatarBufferResolvable | Base64ResolvableThe new avatar

Returns: Promise<GuildMember>Source

setBanner

setBanner(banner: BufferResolvable | Base64Resolvable): Promise<GuildMember>

Sets the guild banner of the logged in client. Parameters

NameTypeDescription
bannerBufferResolvable | Base64ResolvableThe new banner

Returns: Promise<GuildMember>Source

setAboutMe

setAboutMe(bio: string | null): Promise<GuildMember>

Set Guild About me Parameters

NameTypeDescription
biostring | nullBio to set Default: null.

Returns: Promise<GuildMember>Source

send

send(options: string | MessagePayload | MessageOptions): Promise<Message>

Sends a message to this user. Parameters

NameTypeDescription
optionsstring | MessagePayload | MessageOptionsThe options to provide

Returns: Promise<Message>

js
// Send a direct message
guildMember.send('Hello!')
  .then(message => console.log(`Sent message: ${message.content} to ${guildMember.displayName}`))
  .catch(console.error);

Source

Unofficial software. Not affiliated with or supported by Discord.