Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions handlers/verify.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import logging
from datetime import datetime

import os
from aiogram import Bot, Router
from aiogram.filters import Command
from aiogram.types import CallbackQuery, Message
Expand All @@ -17,7 +15,6 @@

VERIFY_COOLDOWN_SECONDS = 60


async def _run_verification(db_user: dict, send_func, bot: Bot) -> None:
"""Core verification logic shared by command and callback."""
try:
Expand Down Expand Up @@ -95,7 +92,7 @@ async def _run_verification(db_user: dict, send_func, bot: Bot) -> None:
target_username=mission["target_instagram_username"],
)
except Exception as e:
logger.error(f"Verification error for @{mission['target_instagram_username']}: {e}")
logger.error(f"Verification error for @{mission['target_instagram_username']}: {e})
missing_usernames.append(mission["target_instagram_username"])
continue

Expand Down Expand Up @@ -167,7 +164,8 @@ async def _run_verification(db_user: dict, send_func, bot: Bot) -> None:
level_emoji=Texts.LEVEL_EMOJIS.get(updated_user["level"], "🌱"),
)
elif verified_count > 0:
missing_text = "\n".join(f" • @{u}" for u in missing_usernames)
missing_text = \"
".join(f" • @{u}" for u in missing_usernames)
text = Texts.VERIFY_PARTIAL.format(
verified=verified_count,
total=total,
Expand All @@ -194,18 +192,15 @@ async def _run_verification(db_user: dict, send_func, bot: Bot) -> None:
except Exception:
pass


@router.message(Command("verifier"))
async def cmd_verify(message: Message, db_user: dict, bot: Bot, **kwargs) -> None:
await _run_verification(db_user, message.answer, bot)


@router.callback_query(MenuCallback.filter(lambda c: c.action == "verify"))
async def cb_verify_menu(callback: CallbackQuery, db_user: dict, bot: Bot, **kwargs) -> None:
await callback.answer()
await _run_verification(db_user, callback.message.answer, bot)


@router.callback_query(VerifyCallback.filter())
async def cb_verify_batch(
callback: CallbackQuery, callback_data: VerifyCallback, db_user: dict, bot: Bot, **kwargs
Expand Down