diff --git a/discord/flags.py b/discord/flags.py index 0cc106e5d..cd8557a31 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -851,6 +851,10 @@ class MemberCacheFlags(BaseFlags): self.value = self.DEFAULT_VALUE return self + @property + def _empty(self): + return self.value == self.DEFAULT_VALUE + @flag_value def online(self): """:class:`bool`: Whether to cache members with a status. diff --git a/discord/state.py b/discord/state.py index 54de09cdf..838a8f45f 100644 --- a/discord/state.py +++ b/discord/state.py @@ -186,6 +186,9 @@ class ConnectionState: self._status = status self._intents = intents + if not intents.members or cache_flags._empty: + self.store_user = self.store_user_no_intents + self.parsers = parsers = {} for attr, func in inspect.getmembers(self): if attr.startswith('parse_'): @@ -279,6 +282,9 @@ class ConnectionState: self._users[user_id] = user return user + def store_user_no_intents(self, data): + return User(state=self, data=data) + def get_user(self, id): return self._users.get(id)