mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
fix: Convert lastMessage to getters (#2384)
* convert lastMessage to getters * fix bug in pr * requested changes
This commit is contained in:
@@ -43,10 +43,10 @@ class GuildMember extends Base {
|
||||
this.lastMessageID = null;
|
||||
|
||||
/**
|
||||
* The Message object of the last message sent by the member in their guild, if one was sent
|
||||
* @type {?Message}
|
||||
* The ID of the channel for the last message sent by the member in their guild, if one was sent
|
||||
* @type {?Snowflake}
|
||||
*/
|
||||
this.lastMessage = null;
|
||||
this.lastMessageChannelID = null;
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
@@ -81,6 +81,16 @@ class GuildMember extends Base {
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Message object of the last message sent by the member in their guild, if one was sent
|
||||
* @type {?Message}
|
||||
* @readonly
|
||||
*/
|
||||
get lastMessage() {
|
||||
const channel = this.guild.channels.get(this.lastMessageChannelID);
|
||||
return (channel && channel.messages.get(this.lastMessageID)) || null;
|
||||
}
|
||||
|
||||
get voiceState() {
|
||||
return this._frozenVoiceState || this.guild.voiceStates.get(this.id) || {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user