From 565e77f595527b3fd5ba5fd8a8e58d769c781426 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 10 Jul 2026 15:42:29 +0300 Subject: Add CommunityManager::get_input_community. --- td/telegram/CommunityManager.cpp | 14 ++++++++++++++ td/telegram/CommunityManager.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/td/telegram/CommunityManager.cpp b/td/telegram/CommunityManager.cpp index fc7e9ed32..6e1fca02e 100644 --- a/td/telegram/CommunityManager.cpp +++ b/td/telegram/CommunityManager.cpp @@ -605,6 +605,20 @@ td_api::object_ptr CommunityManager::get_update_unknown RestrictedRights::restrict_all().get_community_permissions_object())); } +telegram_api::object_ptr CommunityManager::get_input_community( + CommunityId community_id) const { + int64 access_hash = 0; + const Community *c = get_community(community_id); + if (c == nullptr) { + if (!td_->auth_manager_->is_bot() || !community_id.is_valid()) { + return nullptr; + } + } else { + access_hash = c->access_hash; + } + return telegram_api::make_object(community_id.get(), access_hash); +} + void CommunityManager::get_current_state(vector> &updates) const { for (auto community_id : unknown_communities_) { if (!have_community(community_id)) { diff --git a/td/telegram/CommunityManager.h b/td/telegram/CommunityManager.h index 56cd734bb..e53c11c0f 100644 --- a/td/telegram/CommunityManager.h +++ b/td/telegram/CommunityManager.h @@ -44,6 +44,8 @@ class CommunityManager final : public Actor { td_api::object_ptr get_community_object(CommunityId community_id) const; + telegram_api::object_ptr get_input_community(CommunityId community_id) const; + void on_binlog_community_event(BinlogEvent &&event); void get_current_state(vector> &updates) const; -- cgit v1.2.3