diff --git a/reply.py b/reply.py index 440f486..7de3726 100755 --- a/reply.py +++ b/reply.py @@ -80,7 +80,7 @@ class ReplyBot: try: status = await self.pleroma.get_status(argument) if status['content'] != "": - keywords = cleanup_toot(utils.extract_post_content(status['content']), self.cfg) + keywords = self.cleanup_toot(utils.extract_post_content(status['content']), self.cfg) else: keywords = None @@ -88,8 +88,9 @@ class ReplyBot: toot = self.cleanup_toot(toot, self.cfg) await self.pleroma.reply(status, toot, cw=self.cfg['cw']) except: - tg.start_soon(self.pleroma.react, post_id, '❌') - tg.start_soon(self.pleroma.reply, notification['status'], 'Error: ' + exc.args[0]) + async with anyio.create_task_group() as tg: + tg.start_soon(self.pleroma.react, post_id, '❌') + tg.start_soon(self.pleroma.reply, notification['status'], 'Error: ' + exc.args[0]) except pleroma.BadRequest as exc: async with anyio.create_task_group() as tg: tg.start_soon(self.pleroma.react, post_id, '❌')