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) await self.unsub(channel_id, session_id)
continue continue
wanted_intent = EVENTS_TO_INTENTS[event_type] wanted_intent = EVENTS_TO_INTENTS.get(event_type)
state_has_intent = (state.intents & wanted_intent) == wanted_intent if wanted_intent is not None:
if not state_has_intent: state_has_intent = (state.intents & wanted_intent) == wanted_intent
continue if not state_has_intent:
continue
correct_event = event correct_event = event
# for cases where we are talking about group dms, we create an edited # 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) await self.unsub(guild_id, session_id)
continue continue
wanted_intent = EVENTS_TO_INTENTS[event_type] wanted_intent = EVENTS_TO_INTENTS.get(event_type)
state_has_intent = (state.intents & wanted_intent) == wanted_intent if wanted_intent is not None:
if not state_has_intent: state_has_intent = (state.intents & wanted_intent) == wanted_intent
continue if not state_has_intent:
continue
try: try:
await state.ws.dispatch(*event) await state.ws.dispatch(*event)