toxicity-detector

This commit is contained in:
2024-02-12 15:50:35 +03:00
parent ec82174dc9
commit 7fd358931a
10 changed files with 166 additions and 255 deletions

View File

@@ -27,10 +27,9 @@ async def show_announce(msg):
newcomer_message = get_newcomer_message(msg)
userphotos_response = await telegram_api("getUserphotos", user_id=from_id)
logger.debug(userphotos_response)
file_id = ""
if userphotos_response["ok"] and userphotos_response["result"]["total_count"] > 0:
if isinstance(userphotos_response, dict) and userphotos_response["ok"] and userphotos_response["result"]["total_count"] > 0:
logger.info("showing button with photo")
file_id = userphotos_response["result"]["photos"][0][0]["file_id"]