diff --git a/litecord/dispatcher.py b/litecord/dispatcher.py index a1e2c58..b2d0ab2 100644 --- a/litecord/dispatcher.py +++ b/litecord/dispatcher.py @@ -11,8 +11,9 @@ log = Logger(__name__) class EventDispatcher: """Pub/Sub routines for litecord.""" - def __init__(self, sm): - self.state_manager = sm + def __init__(self, app): + self.state_manager = app.state_manager + self.app = app self.backends = { 'guild': GuildDispatcher(self), diff --git a/litecord/pubsub/dispatcher.py b/litecord/pubsub/dispatcher.py index 42d83e7..59cf08c 100644 --- a/litecord/pubsub/dispatcher.py +++ b/litecord/pubsub/dispatcher.py @@ -11,6 +11,7 @@ class Dispatcher: def __init__(self, main): self.main_dispatcher = main self.sm = main.state_manager + self.app = main.app async def sub(self, _key, _id): raise NotImplementedError diff --git a/run.py b/run.py index 45209bb..c48646b 100644 --- a/run.py +++ b/run.py @@ -93,9 +93,9 @@ async def app_before_serving(): g.loop = asyncio.get_event_loop() app.state_manager = StateManager() - app.dispatcher = EventDispatcher(app.state_manager) - app.storage = Storage(app.db) + + app.dispatcher = EventDispatcher(app) app.presence = PresenceManager(app.storage, app.state_manager, app.dispatcher) app.storage.presence = app.presence