Created At: 2026-11-18T18:21:18Z Completed At: 2026-11-18T18:21:18Z Command exited with code 0. Command output: async def verify_bot_admin( self, bot_id: uuid.UUID, raw_token: str, chat_id: str | int, ) -> dict[str, Any]: """ Verifies if the bot is added as an Administrator in the given channel or group. Returns permissions details, forum/topic support, and actionable guidance. """ # 1. Fetch Chat Info chat_resp = await TelegramApiService.get_chat(raw_token=raw_token, chat_id=chat_id) if not chat_resp.get("ok"): error_desc = chat_resp.get("error", "Chat not found or bot does not have access") return { "is_admin": False, "chat_id": chat_id, "error": error_desc, "message": f"Could not access '{chat_id}'. Ensure the bot is added to the channel/group first.", } chat_info = chat_resp.get("result", {}) chat_title = chat_info.get("title", str(chat_id)) chat_type = chat_info.get("type", "channel") is_forum = bool(chat_info.get("is_forum", False)) # 2. Fetch Administrators admin_resp = await TelegramApiService.get_chat_administrators(raw_token=raw_token, chat_id=chat_id) if not admin_resp.get("ok"): return { "is_admin": False, "chat_id": chat_id, "chat_title": chat_title, "chat_type": chat_type, "is_forum": is_forum, "message": "Bot is present in chat but is not an administrator, or lacks permission to view administrators.", } admins = admin_resp.get("result", []) bot_admin_record = None for admin in admins: user = admin.get("user", {}) if user.get("is_bot") and admin.get("status") in ("administrator", "creator"): bot_admin_record = admin break if not bot_admin_record: return { "is_admin": False, "chat_id": chat_id, "chat_title": chat_title, "chat_type": chat_type, "is_forum": is_forum, "message": f"Bot is in '{chat_title}' but has NOT been promoted to Administrator. Please grant Admin rights in Telegram.", }