class GuildMember
extends
Baseexport class GuildMember extends BaseRepresents a member of a guild on Discord.
readonlybannable : boolean
Whether this member is bannable by the client user
The timestamp this member's timeout will be removed
readonlydisplayColor : number
The displayed role color of this member in base 10
readonlydisplayHexColor : HexColorString
The displayed role color of this member in hexadecimal
readonlydisplayName : string
The nickname of this member, or their user display name if they don't have one
flags : Readonly<GuildMemberFlagsBitField>
The flags of this member
guild : Guild
The guild that this member is part of
readonlyid : Snowflake
The member's id
readonlykickable : boolean
Whether this member is kickable by the client user
readonlymanageable : 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.
readonlymoderatable : boolean
Whether this member is moderatable by the client user
pending : boolean
Whether this member has yet to pass the guild's membership gate
readonlypermissions : Readonly<PermissionsBitField>
The overall set of permissions for this member, taking only roles and owner status into account
readonlyroles : GuildMemberRoleManager
A manager for the roles belonging to this member
user : User
The user that this guild member instance represents
readonlyvoice : VoiceState
The voice state of this member
avatarURL(options?: ImageURLOptions) : string | null
A link to the member's guild avatar.
ban(options?: BanOptions) : Promise<GuildMember>
Bans this guild member.
// 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); bannerURL(options?: ImageURLOptions) : string | null
A link to the member's banner.
Creates a DM channel between the client and this member.
disableCommunicationUntil(communicationDisabledUntil: DateResolvable | nullreason?: string) : Promise<GuildMember>
Times this guild member out.
// Time a guild member out for 5 minutes
guildMember.disableCommunicationUntil(Date.now() + (5 * 60 * 1000), 'They deserved it')
.then(console.log)
.catch(console.error);// Remove the timeout of a guild member
guildMember.disableCommunicationUntil(null)
.then(member => console.log(`Removed timeout for ${member.displayName}`))
.catch(console.error); displayAvatarURL(options?: ImageURLOptions) : string
A link to the member's guild avatar if they have one. Otherwise, a link to their displayAvatarURL will be returned.
displayBannerURL(options?: ImageURLOptions) : string | null
A link to the member's guild banner if they have one. Otherwise, a link to their bannerURL will be returned.
edit(options: GuildMemberEditOptions) : Promise<GuildMember>
Edits this member.
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.
fetch(force?: boolean) : Promise<GuildMember>
Fetches this GuildMember.
isCommunicationDisabled() : this is GuildMember & { communicationDisabledUntilTimestamp: number; readonly communicationDisabledUntil: Date; }
Whether this member is currently timed out
kick(reason?: string) : Promise<GuildMember>
Kicks this member from the guild.
permissionsIn(channel: GuildChannelResolvable) : Readonly<PermissionsBitField>
Returns channel.permissionsFor(guildMember). Returns permissions for a member in a guild channel, taking into account roles and permission overwrites.
send(options: string | MessagePayload | MessageCreateOptions) : Promise<Message>
Sends a message to this user.
// Send a direct message
guildMember.send('Hello!')
.then(message => console.log(`Sent message: ${message.content} to ${guildMember.displayName}`))
.catch(console.error); setFlags(flags: GuildMemberFlagsResolvablereason?: string) : Promise<GuildMember>
Sets the flags for this member.
setNickname() : Promise<GuildMember>
Sets the nickname for this member.
// 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);// 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);timeout() : Promise<GuildMember>
Times this guild member out.
// Time a guild member out for 5 minutes
guildMember.timeout(5 * 60 * 1000, 'They deserved it')
.then(console.log)
.catch(console.error);toJSON() : unknown
toString() : UserMention
When concatenated with a string, this automatically returns the user's mention instead of the GuildMember object.
// Logs: Hello from <@123456789012345678>!
console.log(`Hello from ${member}!`);