fix: enrich VK conversation titles
This commit is contained in:
1 parent
d70b9e5864
commit
ae04d7cb09
1 file changed
+7
-1
+7
-1
@@ -881,8 +881,14 @@ class BelkiBot:
|
|||||||
if peer_id and int(peer_id) >= 2_000_000_000:
|
if peer_id and int(peer_id) >= 2_000_000_000:
|
||||||
chat_id = 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"}:
|
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,
|
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"}:
|
elif action in {"chat_kick_user", "chat_leave_user"}:
|
||||||
self.conversation_store.mark_removed(int(peer_id), action)
|
self.conversation_store.mark_removed(int(peer_id), action)
|
||||||
sender_id = message.get("from_id", message.get("sender_id", peer_id))
|
sender_id = message.get("from_id", message.get("sender_id", peer_id))
|
||||||
|
|||||||
Reference in new issue
Block a user