diff --git a/litecord/gateway/state.py b/litecord/gateway/state.py index 3bac060..eb2925e 100644 --- a/litecord/gateway/state.py +++ b/litecord/gateway/state.py @@ -94,5 +94,9 @@ class GatewayState: self.large: int = kwargs.get("large") or 50 + def __bool__(self): + """Return if the given state is a valid state to be used.""" + return self.ws is not None + def __repr__(self): return f"GatewayState" diff --git a/litecord/pubsub/lazy_guild.py b/litecord/pubsub/lazy_guild.py index 38198ef..5bc2d38 100644 --- a/litecord/pubsub/lazy_guild.py +++ b/litecord/pubsub/lazy_guild.py @@ -593,10 +593,7 @@ class GuildMemberList: dispatched = [] for state in states: - if state is None: - continue - - if state.ws is None: + if not state: continue await state.ws.dispatch("GUILD_MEMBER_LIST_UPDATE", payload)