diff --git a/tasks.py b/tasks.py index d696bbb..4890458 100644 --- a/tasks.py +++ b/tasks.py @@ -84,6 +84,44 @@ def follow(ctx): asyncio.run(_dodo()) +@task +def accept_follow_again(ctx): + from app.database import async_session + from sqlalchemy import select + from sqlalchemy.orm import joinedload + from app import models + from app.boxes import _send_accept + + inbox_id = prompt("enter want to accept inbox id:") + + async def _do(): + async with async_session() as db_session: #type: ignore + try: + exist_inbox = ( + await db_session.scalars( + select(models.InboxObject).where( + models.InboxObject.id == int(inbox_id) + ).options( + joinedload(models.InboxObject.actor) + ) + ) + ).one_or_none() + + await _send_accept( + db_session, + exist_inbox.actor, + exist_inbox, + ) + await db_session.commit() + except Exception as e: + print(f"ERROR: Failed to {e}") + return + + print("Done!") + + asyncio.run(_do()) + + @task def accept_follow(ctx): from app.database import async_session