From d32ccc52ec1f59757ff8f3566663462b8f8a161f Mon Sep 17 00:00:00 2001 From: missytake Date: Thu, 3 Mar 2022 20:09:34 +0100 Subject: [PATCH] [mastodon] Load database references --- kibicara/platforms/mastodon/bot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kibicara/platforms/mastodon/bot.py b/kibicara/platforms/mastodon/bot.py index 91dcd20..8c6d9b4 100644 --- a/kibicara/platforms/mastodon/bot.py +++ b/kibicara/platforms/mastodon/bot.py @@ -8,7 +8,7 @@ from kibicara.platformapi import Censor, Spawner, Message from kibicara.platforms.mastodon.model import MastodonAccount from mastodon import Mastodon, MastodonError -from asyncio import gather +from asyncio import gather, get_event_loop import sys from logging import getLogger @@ -21,13 +21,14 @@ class MastodonBot(Censor): super().__init__(mastodon_account_model.hood) self.model = mastodon_account_model self.enabled = self.model.enabled + + async def run(self): + await self.model.instance.load() self.account = Mastodon( client_id=self.model.instance.client_id, client_secret=self.model.instance.client_secret, access_token=self.model.access_token, ) - - async def run(self): await gather(self.poll(), self.push()) async def poll(self):