mirror of https://gitlab.com/litecord/litecord.git
add intents support to channel dispatcher
This commit is contained in:
parent
dae56a68ae
commit
bc1c0f3b20
|
|
@ -23,7 +23,7 @@ from dataclasses import dataclass
|
||||||
from quart import current_app as app
|
from quart import current_app as app
|
||||||
from logbook import Logger
|
from logbook import Logger
|
||||||
|
|
||||||
from litecord.enums import ChannelType
|
from litecord.enums import ChannelType, EVENTS_TO_INTENTS
|
||||||
from litecord.utils import index_by_func
|
from litecord.utils import index_by_func
|
||||||
from .dispatcher import DispatcherWithFlags, GatewayEvent
|
from .dispatcher import DispatcherWithFlags, GatewayEvent
|
||||||
|
|
||||||
|
|
@ -69,13 +69,9 @@ class ChannelDispatcher(
|
||||||
await self.unsub(channel_id, session_id)
|
await self.unsub(channel_id, session_id)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
wanted_intent = EVENTS_TO_INTENTS[event_type]
|
||||||
flags = self.get_flags(channel_id, session_id)
|
state_has_intent = (state.intents & wanted_intent) == wanted_intent
|
||||||
except KeyError:
|
if not state_has_intent:
|
||||||
log.warning("no flags for {!r}, ignoring", session_id)
|
|
||||||
flags = ChannelFlags(typing=True)
|
|
||||||
|
|
||||||
if event_type.lower().startswith("typing_") and not flags.typing:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
correct_event = event
|
correct_event = event
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue