Add Mastodon bot to Ticketfrei 3 #2

Merged
missytake merged 32 commits from mastodon into development 2023-03-19 19:31:03 +00:00
Showing only changes of commit 12935b79cb - Show all commits

View file

@ -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):