From 49003c5cced2653d896f688f714871fb97d1f0ea Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 9 Feb 2024 14:39:35 +0300 Subject: [PATCH] Generate boost links for supergroups and in new format, --- td/generate/scheme/td_api.tl | 5 ++++- td/telegram/BoostManager.cpp | 10 ++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 2edb36378..ab53217e9 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3793,7 +3793,10 @@ chatBoostStatus boost_url:string applied_slot_ids:vector level:int32 gift //@expiration_date Point in time (Unix timestamp) when the boost will expire chatBoost id:string count:int32 source:ChatBoostSource start_date:int32 expiration_date:int32 = ChatBoost; -//@description Contains a list of boosts applied to a chat @total_count Total number of boosts applied to the chat @boosts List of boosts @next_offset The offset for the next request. If empty, then there are no more results +//@description Contains a list of boosts applied to a chat +//@total_count Total number of boosts applied to the chat +//@boosts List of boosts +//@next_offset The offset for the next request. If empty, then there are no more results foundChatBoosts total_count:int32 boosts:vector next_offset:string = FoundChatBoosts; //@description Describes a slot for chat boost diff --git a/td/telegram/BoostManager.cpp b/td/telegram/BoostManager.cpp index d7dc05f7a..3d6084640 100644 --- a/td/telegram/BoostManager.cpp +++ b/td/telegram/BoostManager.cpp @@ -414,22 +414,20 @@ Result> BoostManager::get_dialog_boost_link(DialogId dia if (!td_->dialog_manager_->have_input_peer(dialog_id, AccessRights::Read)) { return Status::Error(400, "Can't access the chat"); } - if (dialog_id.get_type() != DialogType::Channel || - !td_->contacts_manager_->is_broadcast_channel(dialog_id.get_channel_id())) { + if (dialog_id.get_type() != DialogType::Channel) { return Status::Error(400, "Can't boost the chat"); } SliceBuilder sb; - sb << LinkManager::get_t_me_url(); + sb << LinkManager::get_t_me_url() << "boost"; auto username = td_->contacts_manager_->get_channel_first_username(dialog_id.get_channel_id()); bool is_public = !username.empty(); if (is_public) { - sb << username; + sb << '/' << username; } else { - sb << "c/" << dialog_id.get_channel_id().get(); + sb << "?c=" << dialog_id.get_channel_id().get(); } - sb << "?boost"; return std::make_pair(sb.as_cslice().str(), is_public); }