From ae04d7cb09c591f4266476cf610c6ff41e3c951d Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Sun, 6 Sep 2026 18:30:47 +0300 Subject: [PATCH] fix: enrich VK conversation titles --- app/belki/vk_bot.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/belki/vk_bot.py b/app/belki/vk_bot.py index 27fe82a..4f17777 100644 --- a/app/belki/vk_bot.py +++ b/app/belki/vk_bot.py @@ -881,8 +881,14 @@ class BelkiBot: if peer_id and int(peer_id) >= 2_000_000_000: chat_id = int(peer_id) - 2_000_000_000 if action in {"chat_invite_user", "chat_invite_user_by_link"}: + title = (message.get("chat_settings") or {}).get("title") + if not title: + try: + title = self.client.call("messages.getChat", {"chat_id": chat_id}).get("title") + except (VkError, OSError, TimeoutError): + title = None self.conversation_store.upsert_conversation(peer_id=int(peer_id), chat_id=chat_id, - title=(message.get("chat_settings") or {}).get("title"), invited_by=message.get("from_id")) + title=title, invited_by=message.get("from_id")) elif action in {"chat_kick_user", "chat_leave_user"}: self.conversation_store.mark_removed(int(peer_id), action) sender_id = message.get("from_id", message.get("sender_id", peer_id))