fix(Guild): memberCount not decrementing when an uncached member leaves

This leads to GuildMemberStore#_fetchMany to always reject
because it expects more member than possible.

Also no longer call the GuildMemberRemove handler locally
to not decrement twice.
This commit is contained in:
Pascal
2018-01-21 07:30:59 +01:00
parent 986e6da196
commit 93e083da4f
2 changed files with 2 additions and 7 deletions

View File

@@ -8,8 +8,8 @@ class GuildMemberRemoveAction extends Action {
let member = null;
if (guild) {
member = guild.members.get(data.user.id);
guild.memberCount--;
if (member) {
guild.memberCount--;
guild.members.remove(member.id);
if (client.status === Status.READY) client.emit(Events.GUILD_MEMBER_REMOVE, member);
}

View File

@@ -526,12 +526,7 @@ class GuildMember extends Base {
*/
kick(reason) {
return this.client.api.guilds(this.guild.id).members(this.user.id).delete({ reason })
.then(() =>
this.client.actions.GuildMemberRemove.handle({
guild_id: this.guild.id,
user: this.user,
}).member
);
.then(() => this);
}
/**