From 9ab9270ff41f7d29e458e61e3a8e63b5f1ce8863 Mon Sep 17 00:00:00 2001 From: Onur Atakan ULUSOY Date: Mon, 15 Apr 2024 02:34:56 +0300 Subject: [PATCH] Some fix for get_last_dialogs --- .../communication/telegram/as_user/get_last_dialogs.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tiger/tools/communication/telegram/as_user/get_last_dialogs.py b/tiger/tools/communication/telegram/as_user/get_last_dialogs.py index 39eb335..fba7642 100644 --- a/tiger/tools/communication/telegram/as_user/get_last_dialogs.py +++ b/tiger/tools/communication/telegram/as_user/get_last_dialogs.py @@ -24,15 +24,18 @@ async def fetch_recent_chats(limit): number = "" type_of_entity = "" if chat.is_user: - number = chat.entity.phone + number = chat.entity.phone or chat.entity.username type_of_entity = "user" if chat.is_channel: - number = chat.entity.username or chat.entity.id + number = chat.entity.username type_of_entity = "channel" if chat.is_group: number = chat.entity.id type_of_entity = "group" - chat_names[chat.id] = { + + if number == None: + number = chat.entity.id + chat_names[str(chat.id)] = { "number": number, "title": chat.name or chat.title, "type_of_entity": type_of_entity,