mirror of https://gitlab.com/litecord/litecord.git
run: pass app instance to EventDispatcher
this should help with future DM channel pub/sub, as we'll have to query the `dm_channel_state` table.
This commit is contained in:
parent
b43b220882
commit
b7f0bd1bb4
|
|
@ -11,8 +11,9 @@ log = Logger(__name__)
|
||||||
|
|
||||||
class EventDispatcher:
|
class EventDispatcher:
|
||||||
"""Pub/Sub routines for litecord."""
|
"""Pub/Sub routines for litecord."""
|
||||||
def __init__(self, sm):
|
def __init__(self, app):
|
||||||
self.state_manager = sm
|
self.state_manager = app.state_manager
|
||||||
|
self.app = app
|
||||||
|
|
||||||
self.backends = {
|
self.backends = {
|
||||||
'guild': GuildDispatcher(self),
|
'guild': GuildDispatcher(self),
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ class Dispatcher:
|
||||||
def __init__(self, main):
|
def __init__(self, main):
|
||||||
self.main_dispatcher = main
|
self.main_dispatcher = main
|
||||||
self.sm = main.state_manager
|
self.sm = main.state_manager
|
||||||
|
self.app = main.app
|
||||||
|
|
||||||
async def sub(self, _key, _id):
|
async def sub(self, _key, _id):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
|
||||||
4
run.py
4
run.py
|
|
@ -93,9 +93,9 @@ async def app_before_serving():
|
||||||
g.loop = asyncio.get_event_loop()
|
g.loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
app.state_manager = StateManager()
|
app.state_manager = StateManager()
|
||||||
app.dispatcher = EventDispatcher(app.state_manager)
|
|
||||||
|
|
||||||
app.storage = Storage(app.db)
|
app.storage = Storage(app.db)
|
||||||
|
|
||||||
|
app.dispatcher = EventDispatcher(app)
|
||||||
app.presence = PresenceManager(app.storage,
|
app.presence = PresenceManager(app.storage,
|
||||||
app.state_manager, app.dispatcher)
|
app.state_manager, app.dispatcher)
|
||||||
app.storage.presence = app.presence
|
app.storage.presence = app.presence
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue