run.py: only pass app instance to PresenceManager

- presence: only receive app when instantiating
This commit is contained in:
Luna 2019-02-03 22:44:43 -03:00
parent 6ee5b2fa15
commit d95b6adb16
2 changed files with 6 additions and 11 deletions

View File

@ -78,11 +78,11 @@ async def _pres(storage, user_id: int, status_obj: dict) -> dict:
class PresenceManager: class PresenceManager:
"""Presence related functions.""" """Presence related functions."""
def __init__(self, storage, user_storage, state_manager, dispatcher): def __init__(self, app):
self.storage = storage self.storage = app.storage
self.user_storage = user_storage self.user_storage = app.user_storage
self.state_manager = state_manager self.state_manager = app.state_manager
self.dispatcher = dispatcher self.dispatcher = app.dispatcher
async def guild_presences(self, member_ids: List[int], async def guild_presences(self, member_ids: List[int],
guild_id: int) -> List[Dict[Any, str]]: guild_id: int) -> List[Dict[Any, str]]:

7
run.py
View File

@ -227,12 +227,7 @@ def init_app_managers(app_):
app_.icons = IconManager(app) app_.icons = IconManager(app)
app_.dispatcher = EventDispatcher(app) app_.dispatcher = EventDispatcher(app)
app_.presence = PresenceManager(app_)
# TODO: only pass app
app_.presence = PresenceManager(
app.storage, app.user_storage,
app.state_manager, app.dispatcher
)
app_.storage.presence = app.presence app_.storage.presence = app.presence