diff --git a/opter_outer.py b/opter_outer.py index 8dfc177..7cab300 100755 --- a/opter_outer.py +++ b/opter_outer.py @@ -21,14 +21,18 @@ async def main(): anyio.create_task_group() as nursery, ): async for notif in pleroma.stream_notifications(): + handler = None if 'opt out' in notif['status']['content']: - nursery.start_soon(opt_out, db, pleroma, notif['status']) + handler = opt_out elif 'opt in' in notif['status']['content']: - nursery.start_soon(opt_in, db, pleroma, notif['status']) + handler = opt_in elif 'status' in notif['status']['content']: - nursery.start_soon(status, db, pleroma, notif['status']) + handler = status elif 'help' in notif['status']['content']: - nursery.start_soon(help, db, pleroma, notif['status']) + handler = help + + if handler: + nursery.start_soon(handler, db, pleroma, notif['status']) async def opt_out(db, pleroma, status): await db.execute(