pubsub: add passthrough logic

This commit is contained in:
Luna 2021-07-14 15:04:33 -03:00
parent bc1c0f3b20
commit a51840487f
2 changed files with 10 additions and 8 deletions

View File

@ -69,10 +69,11 @@ class ChannelDispatcher(
await self.unsub(channel_id, session_id)
continue
wanted_intent = EVENTS_TO_INTENTS[event_type]
state_has_intent = (state.intents & wanted_intent) == wanted_intent
if not state_has_intent:
continue
wanted_intent = EVENTS_TO_INTENTS.get(event_type)
if wanted_intent is not None:
state_has_intent = (state.intents & wanted_intent) == wanted_intent
if not state_has_intent:
continue
correct_event = event
# for cases where we are talking about group dms, we create an edited

View File

@ -69,10 +69,11 @@ class GuildDispatcher(
await self.unsub(guild_id, session_id)
continue
wanted_intent = EVENTS_TO_INTENTS[event_type]
state_has_intent = (state.intents & wanted_intent) == wanted_intent
if not state_has_intent:
continue
wanted_intent = EVENTS_TO_INTENTS.get(event_type)
if wanted_intent is not None:
state_has_intent = (state.intents & wanted_intent) == wanted_intent
if not state_has_intent:
continue
try:
await state.ws.dispatch(*event)