Browse Source

Remove MemberCacheFlags.online

v8 no longer gives enough data for this to be possible
pull/6701/head
Rapptz 4 years ago
parent
commit
7afcacc9a1
  1. 32
      discord/flags.py

32
discord/flags.py

@ -875,17 +875,6 @@ class MemberCacheFlags(BaseFlags):
def _empty(self):
return self.value == self.DEFAULT_VALUE
@flag_value
def online(self):
""":class:`bool`: Whether to cache members with a status.
For example, members that are part of the initial ``GUILD_CREATE``
or become online at a later point. This requires :attr:`Intents.presences`.
Members that go offline are no longer cached.
"""
return 1
@flag_value
def voice(self):
""":class:`bool`: Whether to cache members that are in voice.
@ -894,7 +883,7 @@ class MemberCacheFlags(BaseFlags):
Members that leave voice are no longer cached.
"""
return 2
return 1
@flag_value
def joined(self):
@ -905,7 +894,7 @@ class MemberCacheFlags(BaseFlags):
Members that leave the guild are no longer cached.
"""
return 4
return 2
@classmethod
def from_intents(cls: Type[MemberCacheFlags], intents: Intents) -> MemberCacheFlags:
@ -926,35 +915,18 @@ class MemberCacheFlags(BaseFlags):
self = cls.none()
if intents.members:
self.joined = True
if intents.presences:
self.online = True
if intents.voice_states:
self.voice = True
if not self.joined and self.online and self.voice:
self.voice = False
return self
def _verify_intents(self, intents: Intents):
if self.online and not intents.presences:
raise ValueError('MemberCacheFlags.online requires Intents.presences enabled')
if self.voice and not intents.voice_states:
raise ValueError('MemberCacheFlags.voice requires Intents.voice_states')
if self.joined and not intents.members:
raise ValueError('MemberCacheFlags.joined requires Intents.members')
if not self.joined and self.voice and self.online:
msg = 'Setting both MemberCacheFlags.voice and MemberCacheFlags.online requires MemberCacheFlags.joined ' \
'to properly evict members from the cache.'
raise ValueError(msg)
@property
def _voice_only(self):
return self.value == 2
@property
def _online_only(self):
return self.value == 1

Loading…
Cancel
Save