[feat] add accept follow again command
All checks were successful
/ run-pytest (push) Successful in 38s

This commit is contained in:
SouthFox 2024-03-10 02:16:14 +08:00
parent d7a02db9ab
commit 523cb1f467

View file

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