[mastodon] Load database references
This commit is contained in:
parent
37f7b98c67
commit
12935b79cb
|
@ -8,7 +8,7 @@ from kibicara.platformapi import Censor, Spawner, Message
|
||||||
from kibicara.platforms.mastodon.model import MastodonAccount
|
from kibicara.platforms.mastodon.model import MastodonAccount
|
||||||
|
|
||||||
from mastodon import Mastodon, MastodonError
|
from mastodon import Mastodon, MastodonError
|
||||||
from asyncio import gather
|
from asyncio import gather, get_event_loop
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
@ -21,13 +21,14 @@ class MastodonBot(Censor):
|
||||||
super().__init__(mastodon_account_model.hood)
|
super().__init__(mastodon_account_model.hood)
|
||||||
self.model = mastodon_account_model
|
self.model = mastodon_account_model
|
||||||
self.enabled = self.model.enabled
|
self.enabled = self.model.enabled
|
||||||
|
|
||||||
|
async def run(self):
|
||||||
|
await self.model.instance.load()
|
||||||
self.account = Mastodon(
|
self.account = Mastodon(
|
||||||
client_id=self.model.instance.client_id,
|
client_id=self.model.instance.client_id,
|
||||||
client_secret=self.model.instance.client_secret,
|
client_secret=self.model.instance.client_secret,
|
||||||
access_token=self.model.access_token,
|
access_token=self.model.access_token,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def run(self):
|
|
||||||
await gather(self.poll(), self.push())
|
await gather(self.poll(), self.push())
|
||||||
|
|
||||||
async def poll(self):
|
async def poll(self):
|
||||||
|
|
Loading…
Reference in a new issue