From 0d5e6e213c572d03b727801a1b63173e3ad7cd35 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 19 Apr 2020 18:21:21 -0400 Subject: [PATCH] Decrement Guild.member_count even if member is not cached Fix #4021 --- discord/state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/state.py b/discord/state.py index 8ad6c01e6..e630724e7 100644 --- a/discord/state.py +++ b/discord/state.py @@ -686,11 +686,11 @@ class ConnectionState: def parse_guild_member_remove(self, data): guild = self._get_guild(int(data['guild_id'])) if guild is not None: + guild._member_count -= 1 user_id = int(data['user']['id']) member = guild.get_member(user_id) if member is not None: guild._remove_member(member) - guild._member_count -= 1 self.dispatch('member_remove', member) else: log.warning('GUILD_MEMBER_REMOVE referencing an unknown guild ID: %s. Discarding.', data['guild_id'])