mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
src/client/websocket/packets/WebSocketPacketManager.js
Unify ready and reconnecting properties into a single status property and future-proof Message class The state of the WebSocketManager is now represented by a single status property, removing emittedReady and reconnecting as representations of state. Message class will now also cache users it isn't aware of that appear in mentions and authors.
This commit is contained in:
@@ -33,7 +33,7 @@ class Guild {
|
||||
|
||||
guildUser.joined_at = guildUser.joined_at || 0;
|
||||
let member = this.store.add('members', new GuildMember(this, guildUser));
|
||||
if (this.client.ws.emittedReady && !noEvent) {
|
||||
if (this.client.ws.status === Constants.Status.READY && !noEvent) {
|
||||
this.client.emit(Constants.Events.GUILD_MEMBER_ADD, this, member);
|
||||
}
|
||||
|
||||
@@ -44,14 +44,14 @@ class Guild {
|
||||
let oldRoles = member.roles;
|
||||
|
||||
member._roles = data.roles;
|
||||
if (this.client.ws.emittedReady) {
|
||||
if (this.client.ws.status === Constants.Status.READY) {
|
||||
this.client.emit(Constants.Events.GUILD_MEMBER_ROLES_UPDATE, this, oldRoles, member.roles);
|
||||
}
|
||||
}
|
||||
|
||||
_removeMember(guildMember) {
|
||||
this.store.remove('members', guildMember);
|
||||
if (this.client.ws.emittedReady) {
|
||||
if (this.client.ws.status === Constants.Status.READY) {
|
||||
this.client.emit(Constants.Events.GUILD_MEMBER_REMOVE, this, guildMember);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user