refactor: remove lastMessage properties from User and GuildMember (#6046)

This commit is contained in:
Antonio Román
2021-07-05 14:11:13 +02:00
committed by GitHub
parent 676118ab0f
commit 1a27f57950
5 changed files with 34 additions and 62 deletions

View File

@@ -34,18 +34,6 @@ class GuildMember extends Base {
*/
this.joinedTimestamp = null;
/**
* The member's last message id, if one was sent
* @type {?Snowflake}
*/
this.lastMessageId = null;
/**
* The id of the channel for the last message sent by the member in their guild, if one was sent
* @type {?Snowflake}
*/
this.lastMessageChannelId = null;
/**
* The timestamp of when the member used their Nitro boost on the guild, if it was used
* @type {?number}
@@ -116,15 +104,6 @@ class GuildMember extends Base {
return new GuildMemberRoleManager(this);
}
/**
* The Message object of the last message sent by the member in their guild, if one was sent
* @type {?Message}
* @readonly
*/
get lastMessage() {
return this.guild.channels.resolve(this.lastMessageChannelId)?.messages.resolve(this.lastMessageId) ?? null;
}
/**
* The voice state of this member
* @type {VoiceState}
@@ -352,8 +331,6 @@ class GuildMember extends Base {
this.partial === member.partial &&
this.guild.id === member.guild.id &&
this.joinedTimestamp === member.joinedTimestamp &&
this.lastMessageId === member.lastMessageId &&
this.lastMessageChannelId === member.lastMessageChannelId &&
this.nickname === member.nickname &&
this.pending === member.pending &&
(this._roles === member._roles ||
@@ -377,8 +354,6 @@ class GuildMember extends Base {
guild: 'guildId',
user: 'userId',
displayName: true,
lastMessage: false,
lastMessageId: false,
roles: true,
});
}

View File

@@ -32,18 +32,6 @@ class User extends Base {
this.flags = null;
/**
* The user's last message id, if one was sent
* @type {?Snowflake}
*/
this.lastMessageId = null;
/**
* The channel in which the last message was sent by the user, if one was sent
* @type {?Snowflake}
*/
this.lastMessageChannelId = null;
this._patch(data);
}
@@ -134,15 +122,6 @@ class User extends Base {
return new Date(this.createdTimestamp);
}
/**
* The Message object of the last message sent by the user, if one was sent
* @type {?Message}
* @readonly
*/
get lastMessage() {
return this.client.channels.resolve(this.lastMessageChannelId)?.messages.resolve(this.lastMessageId) ?? null;
}
/**
* The presence of this user
* @type {Presence}
@@ -316,8 +295,6 @@ class User extends Base {
createdTimestamp: true,
defaultAvatarURL: true,
tag: true,
lastMessage: false,
lastMessageId: false,
},
...props,
);