From f8d487e8c9108aeeda33d3199c1321cd2ed26b7f Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 17 Nov 2023 12:00:08 +0400 Subject: [PATCH] wip Update TDLib to 1.8.21. --- Telegram/SourceFiles/api/api_polls.cpp | 2 +- Telegram/SourceFiles/api/api_premium.cpp | 87 +++ Telegram/SourceFiles/api/api_premium.h | 3 + Telegram/SourceFiles/api/api_sending.cpp | 54 +- Telegram/SourceFiles/api/api_sending.h | 14 +- Telegram/SourceFiles/api/api_statistics.cpp | 22 + Telegram/SourceFiles/api/api_statistics.h | 13 + Telegram/SourceFiles/api/api_updates.cpp | 6 + Telegram/SourceFiles/apiwrap.cpp | 8 +- .../SourceFiles/boxes/gift_premium_box.cpp | 4 + .../boxes/peers/edit_peer_color_box.cpp | 19 + .../boxes/peers/replace_boost_box.cpp | 32 + .../boxes/peers/replace_boost_box.h | 14 + .../boxes/reactions_settings_box.cpp | 2 + Telegram/SourceFiles/boxes/share_box.cpp | 3 +- Telegram/SourceFiles/data/data_drafts.cpp | 1 - Telegram/SourceFiles/data/data_media_types.h | 2 + Telegram/SourceFiles/data/data_peer.cpp | 4 + Telegram/SourceFiles/data/data_session.cpp | 53 ++ Telegram/SourceFiles/data/data_session.h | 9 + Telegram/SourceFiles/history/history_item.cpp | 59 +- Telegram/SourceFiles/history/history_item.h | 5 + .../history/history_item_components.cpp | 42 ++ .../history/history_item_components.h | 8 + .../controls/history_view_draft_options.cpp | 12 + .../view/media/history_view_giveaway.cpp | 11 + .../view/media/history_view_giveaway.h | 7 + .../giveaway/giveaway_list_controllers.cpp | 2 + .../inline_bots/bot_attach_web_view.cpp | 4 +- Telegram/SourceFiles/main/main_app_config.cpp | 6 + Telegram/SourceFiles/main/main_app_config.h | 10 + Telegram/SourceFiles/main/main_session.cpp | 93 +++ Telegram/SourceFiles/main/main_session.h | 9 +- .../media/stories/media_stories_share.cpp | 3 +- .../SourceFiles/payments/payments_form.cpp | 2 + Telegram/SourceFiles/payments/payments_form.h | 2 + .../support/support_autocomplete.cpp | 4 +- Telegram/SourceFiles/tdb/td_api.tl | 651 +++++++++++++----- .../SourceFiles/window/window_peer_menu.cpp | 4 +- Telegram/build/docker/centos_env/Dockerfile | 2 +- Telegram/build/prepare/prepare.py | 2 +- 41 files changed, 1070 insertions(+), 220 deletions(-) diff --git a/Telegram/SourceFiles/api/api_polls.cpp b/Telegram/SourceFiles/api/api_polls.cpp index f66677006f6a5c..953812894ffa7f 100644 --- a/Telegram/SourceFiles/api/api_polls.cpp +++ b/Telegram/SourceFiles/api/api_polls.cpp @@ -80,7 +80,7 @@ void Polls::create( _api.request(Tdb::TLsendMessage( peerToTdbChat(peer->id), - Tdb::tl_int53(action.replyTo.topicRootId.bare), + MessageThreadId(peer, action), MessageReplyTo(action), MessageSendOptions(peer, action), PollToTL(&data) diff --git a/Telegram/SourceFiles/api/api_premium.cpp b/Telegram/SourceFiles/api/api_premium.cpp index f636b4fc310b9d..3b69b371cd534b 100644 --- a/Telegram/SourceFiles/api/api_premium.cpp +++ b/Telegram/SourceFiles/api/api_premium.cpp @@ -30,6 +30,19 @@ namespace { using namespace Tdb; +[[nodiscard]] GiftCode Parse(const TLDpremiumGiftCodeInfo &data) { + return { + .from = peerFromSender(data.vcreator_id()), + .to = data.vuser_id().v ? peerFromUser(data.vuser_id()) : PeerId(), + .giveawayId = data.vgiveaway_message_id().v, + .date = data.vcreation_date().v, + .used = data.vuse_date().v, + .months = data.vmonth_count().v, + .giveaway = data.vis_from_giveaway().v, + }; +} + +#if 0 // mtp [[nodiscard]] GiftCode Parse(const MTPDpayments_checkedGiftCode &data) { return { .from = peerFromMTP(data.vfrom_id()), @@ -59,6 +72,7 @@ using namespace Tdb; } return options; } +#endif } // namespace @@ -398,6 +412,16 @@ void Premium::checkGiftCode( _api.request(_giftCodeRequestId).cancel(); } _giftCodeSlug = slug; + _giftCodeRequestId = _api.request(TLcheckPremiumGiftCode( + tl_string(slug) + )).done([=](const TLDpremiumGiftCodeInfo &data) { + _giftCodeRequestId = 0; + done(updateGiftCode(slug, Parse(data))); + }).fail([=] { + _giftCodeRequestId = 0; + done(updateGiftCode(slug, {})); + }).send(); +#if 0 // mtp _giftCodeRequestId = _api.request(MTPpayments_CheckGiftCode( MTP_string(slug) )).done([=](const MTPpayments_CheckedGiftCode &result) { @@ -412,6 +436,7 @@ void Premium::checkGiftCode( done(updateGiftCode(slug, {})); }).send(); +#endif } GiftCode Premium::updateGiftCode( @@ -435,6 +460,14 @@ rpl::producer Premium::giftCodeValue(const QString &slug) const { } void Premium::applyGiftCode(const QString &slug, Fn done) { + _api.request(TLapplyPremiumGiftCode( + tl_string(slug) + )).done([=] { + done({}); + }).fail([=](const Error &error) { + done(error.message); + }).send(); +#if 0 // mtp _api.request(MTPpayments_ApplyGiftCode( MTP_string(slug) )).done([=](const MTPUpdates &result) { @@ -443,6 +476,7 @@ void Premium::applyGiftCode(const QString &slug, Fn done) { }).fail([=](const MTP::Error &error) { done(error.type()); }).send(); +#endif } void Premium::resolveGiveawayInfo( @@ -461,6 +495,7 @@ void Premium::resolveGiveawayInfo( } _giveawayInfoPeer = peer; _giveawayInfoMessageId = messageId; +#if 0 // mtp _giveawayInfoRequestId = _api.request(MTPpayments_GetGiveawayInfo( _giveawayInfoPeer->input, MTP_int(_giveawayInfoMessageId.bare) @@ -490,6 +525,49 @@ void Premium::resolveGiveawayInfo( info.finishDate = data.vfinish_date().v; info.startDate = data.vstart_date().v; }); +#endif + _giveawayInfoRequestId = _api.request(TLgetPremiumGiveawayInfo( + peerToTdbChat(_giveawayInfoPeer->id), + tl_int53(_giveawayInfoMessageId.bare) + )).done([=](const TLpremiumGiveawayInfo &result) { + _giveawayInfoRequestId = 0; + + auto info = GiveawayInfo(); + result.match([&](const TLDpremiumGiveawayInfoOngoing &data) { + using AlreadyWasMember + = TLDpremiumGiveawayParticipantStatusAlreadyWasMember; + using Participating + = TLDpremiumGiveawayParticipantStatusParticipating; + using Administrator + = TLDpremiumGiveawayParticipantStatusAdministrator; + using DisallowedCountry + = TLDpremiumGiveawayParticipantStatusDisallowedCountry; + + data.vstatus().match([&]( + const TLDpremiumGiveawayParticipantStatusEligible &) { + }, [&](const Participating &) { + info.participating = true; + }, [&](const AlreadyWasMember &data) { + info.tooEarlyDate = data.vjoined_chat_date().v; + }, [&](const Administrator &data) { + info.adminChannelId = peerToChannel( + peerFromTdbChat(data.vchat_id())); + }, [&](const DisallowedCountry &data) { + info.disallowedCountry = data.vuser_country_code().v; + }); + info.state = data.vis_ended().v + ? GiveawayState::Preparing + : GiveawayState::Running; + info.startDate = data.vcreation_date().v; + }, [&](const TLDpremiumGiveawayInfoCompleted &data) { + info.state = data.vwas_refunded().v + ? GiveawayState::Refunded + : GiveawayState::Finished; + info.giftCode = data.vgift_code().v; + info.activatedCount = data.vactivation_count().v; + info.finishDate = data.vactual_winners_selection_date().v; + info.startDate = data.vcreation_date().v; + }); _giveawayInfoDone(std::move(info)); }).fail([=] { _giveawayInfoRequestId = 0; @@ -503,7 +581,10 @@ const Data::SubscriptionOptions &Premium::subscriptionOptions() const { PremiumGiftCodeOptions::PremiumGiftCodeOptions(not_null peer) : _peer(peer) +#if 0 // mtp , _api(&peer->session().api().instance()) { +#endif +, _api(&peer->session().sender()) { } rpl::producer PremiumGiftCodeOptions::request() { @@ -514,6 +595,7 @@ rpl::producer PremiumGiftCodeOptions::request() { return lifetime; } +#if 0 // todo using TLOption = MTPPremiumGiftCodeOption; _api.request(MTPpayments_GetPremiumGiftCodeOptions( MTP_flags( @@ -552,6 +634,7 @@ rpl::producer PremiumGiftCodeOptions::request() { }).fail([=](const MTP::Error &error) { consumer.put_error_copy(error.type()); }).send(); +#endif return lifetime; }; @@ -567,6 +650,7 @@ rpl::producer PremiumGiftCodeOptions::applyPrepaid( return lifetime; } +#if 0 // todo _api.request(MTPpayments_LaunchPrepaidGiveaway( _peer->input, MTP_long(prepaidId), @@ -577,6 +661,7 @@ rpl::producer PremiumGiftCodeOptions::applyPrepaid( }).fail([=](const MTP::Error &error) { consumer.put_error_copy(error.type()); }).send(); +#endif return lifetime; }; @@ -612,6 +697,7 @@ Data::SubscriptionOptions PremiumGiftCodeOptions::options(int amount) { if (it != end(_subscriptionOptions)) { return it->second; } else { +#if 0 // todo auto tlOptions = QVector(); for (auto i = 0; i < _optionsForOnePerson.months.size(); i++) { tlOptions.push_back(MTP_premiumGiftCodeOption( @@ -624,6 +710,7 @@ Data::SubscriptionOptions PremiumGiftCodeOptions::options(int amount) { MTP_long(_optionsForOnePerson.totalCosts[i] * amount))); } _subscriptionOptions[amount] = GiftCodesFromTL(tlOptions); +#endif return _subscriptionOptions[amount]; } } diff --git a/Telegram/SourceFiles/api/api_premium.h b/Telegram/SourceFiles/api/api_premium.h index 58549b3f0ad5cf..181a4e614f03b1 100644 --- a/Telegram/SourceFiles/api/api_premium.h +++ b/Telegram/SourceFiles/api/api_premium.h @@ -215,7 +215,10 @@ class PremiumGiftCodeOptions final { base::flat_map _stores; +#if 0 // mtp MTP::Sender _api; +#endif + Tdb::Sender _api; }; diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp index 56d1f276e2d595..1bbbdc2dd729c1 100644 --- a/Telegram/SourceFiles/api/api_sending.cpp +++ b/Telegram/SourceFiles/api/api_sending.cpp @@ -414,16 +414,16 @@ void SendPreparedAlbumIfReady( const auto session = &peer->session(); session->sender().request(TLsendMessageAlbum( peerToTdbChat(peer->id), - tl_int53(action.replyTo.topicRootId.bare), + MessageThreadId(peer, action), MessageReplyTo(action), tl_messageSendOptions( tl_bool(silentPost), tl_bool(false), // from_background tl_bool(false), // update_order_of_installed_stickers_sets ScheduledToTL(action.options.scheduled), - tl_int32(0)), // sending_id - tl_vector(std::move(contents)), - tl_bool(false) // only_preview + tl_int32(0), // sending_id + tl_bool(false)), // only_preview + tl_vector(std::move(contents)) )).done([=](const TLmessages &result) { // They should've been added by updates. }).fail([=](const Error &error) { @@ -587,7 +587,7 @@ bool SendDice(MessageToSend &message) { const auto &action = message.action; session->sender().request(TLsendMessage( peerToTdbChat(peer->id), - tl_int53(action.replyTo.topicRootId.bare), + MessageThreadId(peer, action), MessageReplyTo(action), MessageSendOptions(peer, action), tl_inputMessageDice(tl_string(emoji), tl_bool(action.clearDraft)) @@ -888,23 +888,51 @@ TLmessageSendOptions MessageSendOptions( tl_bool(false), // from_background tl_bool(false), // update_order_of_installed_stickers_sets ScheduledToTL(action.options.scheduled), - tl_int32(sendingId)); + tl_int32(sendingId), + tl_bool(false)); // only_preview } -std::optional MessageReplyTo( +std::optional MessageReplyTo( + const FullReplyTo &replyTo) { + if (const auto &storyId = replyTo.storyId) { + return tl_inputMessageReplyToStory( + peerToTdbChat(storyId.peer), + tl_int32(storyId.story)); + } else if (const auto to = replyTo.messageId) { + return tl_inputMessageReplyToMessage( + peerToTdbChat(to.peer), + tl_int53(to.msg.bare), + (replyTo.quote.empty() + ? std::optional() + : Api::FormattedTextToTdb(replyTo.quote))); + } + return std::nullopt; +} + +std::optional MessageReplyTo( const SendAction &action) { + return MessageReplyTo(action.replyTo); if (const auto &storyId = action.replyTo.storyId) { - return tl_messageReplyToStory( + return tl_inputMessageReplyToStory( peerToTdbChat(storyId.peer), tl_int32(storyId.story)); - } else if (const auto to = action.replyTo.msgId) { - return tl_messageReplyToMessage( - peerToTdbChat(action.history->peer->id), - tl_int53(to.bare)); + } else if (const auto to = action.replyTo.messageId) { + return tl_inputMessageReplyToMessage( + peerToTdbChat(to.peer), + tl_int53(to.msg.bare), + (action.replyTo.quote.empty() + ? std::optional() + : Api::FormattedTextToTdb(action.replyTo.quote))); } return std::nullopt; } +TLint53 MessageThreadId( + not_null peer, + const SendAction &action) { + return tl_int53(action.replyTo.topicRootId.bare); +} + void SendPreparedMessage( const SendAction &action, TLinputMessageContent content, @@ -924,7 +952,7 @@ void SendPreparedMessage( const auto sendingId = ClientMsgIndex(localId); session->sender().request(TLsendMessage( peerToTdbChat(peer->id), - tl_int53(topicRootId.bare), + MessageThreadId(peer, action), MessageReplyTo(action), MessageSendOptions(peer, action, sendingId), std::move(content) diff --git a/Telegram/SourceFiles/api/api_sending.h b/Telegram/SourceFiles/api/api_sending.h index 225c7d8068046a..e267fdfece0715 100644 --- a/Telegram/SourceFiles/api/api_sending.h +++ b/Telegram/SourceFiles/api/api_sending.h @@ -16,11 +16,16 @@ class PhotoData; class DocumentData; struct FileLoadResult; +namespace tl { +class int64_type; +} // namespace tl + namespace Tdb { class TLinputMessageContent; class TLmessageSchedulingState; class TLmessageSendOptions; -class TLmessageReplyTo; +class TLinputMessageReplyTo; +using TLint53 = tl::int64_type; } // namespace Tdb namespace InlineBots { @@ -57,7 +62,12 @@ void SendConfirmedFile( not_null peer, const SendAction &action, int32 sendingId = 0); -[[nodiscard]] std::optional MessageReplyTo( +[[nodiscard]] std::optional MessageReplyTo( + const FullReplyTo &replyTo); +[[nodiscard]] std::optional MessageReplyTo( + const SendAction &action); +[[nodiscard]] Tdb::TLint53 MessageThreadId( + not_null peer, const SendAction &action); void SendPreparedMessage( diff --git a/Telegram/SourceFiles/api/api_statistics.cpp b/Telegram/SourceFiles/api/api_statistics.cpp index 1f5c093a6e62cc..639dc78f6ef3b7 100644 --- a/Telegram/SourceFiles/api/api_statistics.cpp +++ b/Telegram/SourceFiles/api/api_statistics.cpp @@ -195,10 +195,14 @@ Statistics::Statistics(not_null channel) StatisticsRequestSender::StatisticsRequestSender(not_null channel) : _channel(channel) +, _api(&_channel->session().sender()) { +#if 0 // mtp , _api(&_channel->session().api().instance()) , _timer([=] { checkRequests(); }) { +#endif } +#if 0 // mtp StatisticsRequestSender::~StatisticsRequestSender() { for (const auto &[dcId, ids] : _requests) { for (const auto id : ids) { @@ -247,11 +251,13 @@ auto StatisticsRequestSender::makeRequest(Request &&request) { dcId ? MTP::ShiftDcId(dcId, MTP::kStatsDcShift) : 0 ).overrideId(id)); } +#endif rpl::producer Statistics::request() { return [=](auto consumer) { auto lifetime = rpl::lifetime(); +#if 0 // todo if (!channel()->isMegagroup()) { makeRequest(MTPstats_GetBroadcastStats( MTP_flags(MTPstats_GetBroadcastStats::Flags(0)), @@ -275,6 +281,7 @@ rpl::producer Statistics::request() { consumer.put_error_copy(error.type()); }).send(); } +#endif return lifetime; }; @@ -287,6 +294,7 @@ Statistics::GraphResult Statistics::requestZoom( auto lifetime = rpl::lifetime(); const auto wasEmpty = _zoomDeque.empty(); _zoomDeque.push_back([=] { +#if 0 // todo makeRequest(MTPstats_LoadAsyncGraph( MTP_flags(x ? MTPstats_LoadAsyncGraph::Flag::f_x @@ -305,6 +313,7 @@ Statistics::GraphResult Statistics::requestZoom( }).fail([=](const MTP::Error &error) { consumer.put_error_copy(error.type()); }).send(); +#endif }); if (wasEmpty) { _zoomDeque.front()(); @@ -336,6 +345,7 @@ void PublicForwards::request( return; } const auto offsetPeer = channel()->owner().peer(token.fullId.peer); +#if 0 // todo const auto tlOffsetPeer = offsetPeer ? offsetPeer->input : MTP_inputPeerEmpty(); @@ -418,6 +428,7 @@ void PublicForwards::request( }).fail([=] { _requestId = 0; }).send(); +#endif } MessageStatistics::MessageStatistics( @@ -453,6 +464,7 @@ void MessageStatistics::request(Fn done) { const auto requestPrivateForwards = [=]( const Data::StatisticalGraph &messageGraph) { +#if 0 // todo api().request(MTPchannels_GetMessages( channel()->inputChannel, MTP_vector( @@ -492,8 +504,10 @@ void MessageStatistics::request(Fn done) { }).fail([=](const MTP::Error &error) { requestFirstPublicForwards(messageGraph, {}); }).send(); +#endif }; +#if 0 // todo makeRequest(MTPstats_GetMessageStats( MTP_flags(MTPstats_GetMessageStats::Flags(0)), channel()->inputChannel, @@ -504,11 +518,15 @@ void MessageStatistics::request(Fn done) { }).fail([=](const MTP::Error &error) { requestPrivateForwards({}); }).send(); +#endif } Boosts::Boosts(not_null peer) : _peer(peer) +, _api(&peer->session().sender()) { +#if 0 // mtp , _api(&peer->session().api().instance()) { +#endif } rpl::producer Boosts::request() { @@ -519,6 +537,7 @@ rpl::producer Boosts::request() { return lifetime; } +#if 0 // todo _api.request(MTPpremium_GetBoostsStatus( _peer->input )).done([=](const MTPpremium_BoostsStatus &result) { @@ -577,6 +596,7 @@ rpl::producer Boosts::request() { }).fail([=](const MTP::Error &error) { consumer.put_error_copy(error.type()); }).send(); +#endif return lifetime; }; @@ -591,6 +611,7 @@ void Boosts::requestBoosts( constexpr auto kTlFirstSlice = tl::make_int(kFirstSlice); constexpr auto kTlLimit = tl::make_int(kLimit); const auto gifts = token.gifts; +#if 0 // todo _requestId = _api.request(MTPpremium_GetBoostsList( gifts ? MTP_flags(MTPpremium_GetBoostsList::Flag::f_gifts) @@ -649,6 +670,7 @@ void Boosts::requestBoosts( }).fail([=] { _requestId = 0; }).send(); +#endif } Data::BoostStatus Boosts::boostStatus() const { diff --git a/Telegram/SourceFiles/api/api_statistics.h b/Telegram/SourceFiles/api/api_statistics.h index dddf3654c238be..cd3fcf224748c0 100644 --- a/Telegram/SourceFiles/api/api_statistics.h +++ b/Telegram/SourceFiles/api/api_statistics.h @@ -12,6 +12,8 @@ For license and copyright information please follow this link: #include "data/data_statistics.h" #include "mtproto/sender.h" +#include "tdb/tdb_sender.h" + class ChannelData; class PeerData; @@ -20,6 +22,7 @@ namespace Api { class StatisticsRequestSender { protected: explicit StatisticsRequestSender(not_null channel); +#if 0 // mtp ~StatisticsRequestSender(); template < @@ -31,6 +34,10 @@ class StatisticsRequestSender { [[nodiscard]] MTP::Sender &api() { return _api; } +#endif + [[nodiscard]] Tdb::Sender &api() { + return _api; + } [[nodiscard]] not_null channel() { return _channel; } @@ -39,9 +46,12 @@ class StatisticsRequestSender { void checkRequests(); const not_null _channel; + Tdb::Sender _api; +#if 0 // mtp MTP::Sender _api; base::Timer _timer; base::flat_map> _requests; +#endif }; @@ -119,7 +129,10 @@ class Boosts final { const not_null _peer; Data::BoostStatus _boostStatus; +#if 0 // mtp MTP::Sender _api; +#endif + Tdb::Sender _api; mtpRequestId _requestId = 0; }; diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index cfc0bf74d5f64f..7b9e6c4551667c 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -2781,6 +2781,10 @@ void Updates::applyUpdate(const TLupdate &update) { owner.applyChatTitle(data); }, [&](const TLDupdateChatPhoto &data) { owner.applyChatPhoto(data); + }, [&](const TLDupdateChatAccentColor &data) { + owner.applyChatAccentColor(data); + }, [&](const TLDupdateChatBackgroundCustomEmoji &data) { + owner.applyChatBackgroundCustomEmoji(data); }, [&](const TLDupdateChatPermissions &data) { owner.applyChatPermissions(data); }, [&](const TLDupdateChatLastMessage &data) { @@ -3077,6 +3081,8 @@ void Updates::applyUpdate(const TLupdate &update) { }, [&](const TLDupdateSelectedBackground &data) { }, [&](const TLDupdateChatThemes &data) { session().data().cloudThemes().applyUpdate(data); + }, [&](const TLDupdateAccentColors &data) { + session().applyAccentColors(data); }, [&](const TLDupdateLanguagePackStrings &data) { Lang::CurrentCloudManager().apply(data); }, [&](const TLDupdateTermsOfService &data) { diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index a9cabb5148958b..f48aff79515159 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -4185,11 +4185,11 @@ void ApiWrap::forwardMessages( tl_bool(false), // from_background tl_bool(false), // update_order_of_installed_stickers_sets Api::ScheduledToTL(action.options.scheduled), - tl_int32(0)), // sending_id + tl_int32(0), // sending_id + tl_bool(false)), // only_preview tl_bool(draft.options != Data::ForwardOptions::PreserveInfo), tl_bool( - draft.options == Data::ForwardOptions::NoNamesAndCaptions), - tl_bool(false) // only_preview + draft.options == Data::ForwardOptions::NoNamesAndCaptions) )).done([=](const TLmessages &result) { // They should've been added by updates. }).fail([=](const Error &error) { @@ -4866,7 +4866,7 @@ void ApiWrap::sendInlineResult( const auto sendingId = ClientMsgIndex(localId); sender().request(TLsendInlineQueryResultMessage( peerToTdbChat(peer->id), - tl_int53(action.replyTo.topicRootId.bare), + MessageThreadId(peer, action), MessageReplyTo(action), MessageSendOptions(peer, action, sendingId), tl_int64(data->getQueryId()), diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index bab775e0f3b0f8..b1785432502610 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -593,8 +593,12 @@ void GiftCodeBox( const auto content = controller->parentController()->content(); return content->shareUrl( thread, +#if 0 // mtp MakeGiftCodeLink(&controller->session(), slug).link, QString()); +#endif + { MakeGiftCodeLink(&controller->session(), slug).link }, + true); }; Window::ShowChooseRecipientBox(controller, chosen); return false; diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp index 1ebe391197e30f..ea6f7730f6e8ba 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp @@ -299,7 +299,9 @@ PreviewWrap::PreviewWrap( ? tr::lng_settings_color_reply(tr::now) : tr::lng_settings_color_reply_channel(tr::now), }, +#if 0 // mtp MTP_messageMediaEmpty(), +#endif HistoryMessageMarkupData(), uint64(0))) , _replyItem(_history->addNewLocalMessage( @@ -317,6 +319,7 @@ PreviewWrap::PreviewWrap( ? tr::lng_settings_color_text(tr::now) : tr::lng_settings_color_text_channel(tr::now), }, +#if 0 // mtp MTP_messageMediaWebPage( MTP_flags(0), MTP_webPagePending( @@ -324,12 +327,21 @@ PreviewWrap::PreviewWrap( MTP_long(_webpage->id), MTPstring(), MTP_int(0))), +#endif HistoryMessageMarkupData(), uint64(0))) +#if 0 // mtp , _element(_replyItem->createView(_delegate.get())) +#endif , _position(0, st::msgMargin.bottom()) { _style->apply(_theme.get()); + _replyItem->setMediaExplicit(std::make_unique( + _replyItem.get(), + _webpage.get(), + MediaWebPageFlag::Manual)); + _element = _replyItem->createView(_delegate.get()); + _fake->setName(peer->name(), QString()); std::move(colorIndexValue) | rpl::start_with_next([=](uint8 index) { _fake->changeColorIndex(index); @@ -450,6 +462,7 @@ void Set( ? tr::lng_settings_color_changed(tr::now) : tr::lng_settings_color_changed_channel(tr::now)); }; +#if 0 // todo const auto fail = [=](const MTP::Error &error) { setLocal(wasIndex, wasEmojiId); show->showToast(error.type()); @@ -475,6 +488,7 @@ void Set( } else { Unexpected("Invalid peer type in Set(colorIndex)."); } +#endif } void Apply( @@ -504,6 +518,7 @@ void Apply( Set(show, peer, colorIndex, backgroundEmojiId); close(); } else { +#if 0 // todo session->api().request(MTPpremium_GetBoostsStatus( peer->input )).done([=](const MTPpremium_BoostsStatus &result) { @@ -534,6 +549,7 @@ void Apply( show->showToast(error.type()); cancel(); }).send(); +#endif } } @@ -787,6 +803,7 @@ void EditPeerColorBox( state->emojiId.value() ), {}); +#if 0 // mtp const auto appConfig = &peer->session().account().appConfig(); auto indices = rpl::single( rpl::empty @@ -800,6 +817,8 @@ void EditPeerColorBox( return uint8(i); }) | ranges::to_vector; }); +#endif + auto indices = peer->session().availableColorIndicesValue(); const auto margin = st::settingsColorRadioMargin; const auto skip = st::settingsColorRadioSkip; box->addRow( diff --git a/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp b/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp index 0129b85960c9ac..894dfbf10b69fe 100644 --- a/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp @@ -33,8 +33,12 @@ For license and copyright information please follow this link: #include "styles/style_boxes.h" #include "styles/style_premium.h" +#include "tdb/tdb_tl_scheme.h" + namespace { +using namespace Tdb; + constexpr auto kWaitingOpacity = 0.5; class Row final : public PeerListRow { @@ -376,18 +380,30 @@ object_ptr ReassignBoostSingleBox( } // namespace +#if 0 // mtp ForChannelBoostSlots ParseForChannelBoostSlots( not_null channel, const QVector &boosts) { +#endif +ForChannelBoostSlots ParseForChannelBoostSlots( + not_null channel, + const TLchatBoostSlots &slots) { + const auto &boosts = slots.data().vslots().v; auto result = ForChannelBoostSlots(); const auto now = base::unixtime::now(); for (const auto &my : boosts) { const auto &data = my.data(); +#if 0 // mtp const auto id = data.vslot().v; const auto cooldown = data.vcooldown_until_date().value_or(0); const auto peerId = data.vpeer() ? peerFromMTP(*data.vpeer()) : PeerId(); +#endif + const auto id = data.vslot_id().v; + const auto cooldown = data.vcooldown_until_date().v; + const auto peerId = peerFromTdbChat( + data.vcurrently_boosted_chat_id()); if (!peerId && cooldown <= now) { result.free.push_back(id); } else if (peerId == channel->id) { @@ -395,7 +411,10 @@ ForChannelBoostSlots ParseForChannelBoostSlots( } else { result.other.push_back({ .id = id, +#if 0 // mtp .expires = data.vexpires().v, +#endif + .expires = data.vexpiration_date().v, .peerId = peerId, .cooldown = cooldown, }); @@ -404,6 +423,7 @@ ForChannelBoostSlots ParseForChannelBoostSlots( return result; } +#if 0 // mtp Ui::BoostCounters ParseBoostCounters( const MTPpremium_BoostsStatus &status) { const auto &data = status.data(); @@ -416,6 +436,18 @@ Ui::BoostCounters ParseBoostCounters( .mine = slots ? int(slots->v.size()) : 0, }; } +#endif + +Ui::BoostCounters ParseBoostCounters(const TLchatBoostStatus &status) { + const auto &data = status.data(); + return { + .level = data.vlevel().v, + .boosts = data.vboost_count().v, + .thisLevelBoosts = data.vcurrent_level_boost_count().v, + .nextLevelBoosts = data.vnext_level_boost_count().v, + .mine = int(data.vapplied_slot_ids().v.size()), + }; +} int BoostsForGift(not_null session) { const auto key = u"boosts_per_sent_gift"_q; diff --git a/Telegram/SourceFiles/boxes/peers/replace_boost_box.h b/Telegram/SourceFiles/boxes/peers/replace_boost_box.h index f15cf0b1482000..11c7b63c134869 100644 --- a/Telegram/SourceFiles/boxes/peers/replace_boost_box.h +++ b/Telegram/SourceFiles/boxes/peers/replace_boost_box.h @@ -9,6 +9,11 @@ For license and copyright information please follow this link: #include "base/object_ptr.h" +namespace Tdb { +class TLchatBoostStatus; +class TLchatBoostSlots; +} // namespace Tdb + namespace Main { class Session; } // namespace Main @@ -32,12 +37,21 @@ struct ForChannelBoostSlots { std::vector other; }; +#if 0 // mtp [[nodiscard]] ForChannelBoostSlots ParseForChannelBoostSlots( not_null channel, const QVector &boosts); [[nodiscard]] Ui::BoostCounters ParseBoostCounters( const MTPpremium_BoostsStatus &status); +#endif + +[[nodiscard]] ForChannelBoostSlots ParseForChannelBoostSlots( + not_null channel, + const Tdb::TLchatBoostSlots &slots); + +[[nodiscard]] Ui::BoostCounters ParseBoostCounters( + const Tdb::TLchatBoostStatus &status); [[nodiscard]] int BoostsForGift(not_null session); diff --git a/Telegram/SourceFiles/boxes/reactions_settings_box.cpp b/Telegram/SourceFiles/boxes/reactions_settings_box.cpp index 1220b7e9a375ca..4acbd1a99cf763 100644 --- a/Telegram/SourceFiles/boxes/reactions_settings_box.cpp +++ b/Telegram/SourceFiles/boxes/reactions_settings_box.cpp @@ -57,6 +57,8 @@ PeerId GenerateUser(not_null history, const QString &name) { Tdb::TLstring(), // phone_number Tdb::tl_userStatusEmpty(), // status Tdb::null, // profile_photo + Tdb::tl_int32(Data::DecideColorIndex(peerId)), + Tdb::tl_int64(0), // background_custom_emoji_id Tdb::null, // emoji_status Tdb::tl_bool(false), // is_contact Tdb::tl_bool(false), // is_mutual_contact diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index d4842c159de672..ac8e3e712f570a 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -1540,7 +1540,8 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback( tl_bool(true), // from_background. tl_bool(false), // update_order_of_installed_stickers_sets Api::ScheduledToTL(options.scheduled), - tl_int32(0)); + tl_int32(0), // sending_id + tl_bool(false)); // only_preview // If we have only one message to send // Then there is a chance we should send a game score. diff --git a/Telegram/SourceFiles/data/data_drafts.cpp b/Telegram/SourceFiles/data/data_drafts.cpp index 7976a701d3c3d9..7dd03cf3be6d23 100644 --- a/Telegram/SourceFiles/data/data_drafts.cpp +++ b/Telegram/SourceFiles/data/data_drafts.cpp @@ -180,7 +180,6 @@ void ApplyPeerCloudDraft( auto cloudDraft = std::make_unique( textWithTags, replyTo, - topicRootId, MessageCursor(Ui::kQFixedMax, Ui::kQFixedMax, Ui::kQFixedMax), std::move(webpage)); cloudDraft->date = date; diff --git a/Telegram/SourceFiles/data/data_media_types.h b/Telegram/SourceFiles/data/data_media_types.h index 6055164e0aa48e..506b222e776328 100644 --- a/Telegram/SourceFiles/data/data_media_types.h +++ b/Telegram/SourceFiles/data/data_media_types.h @@ -705,8 +705,10 @@ class MediaGiveaway final : public Media { QString pinnedTextSubstring() const override; TextForMimeData clipboardText() const override; +#if 0 // mtp bool updateInlineResultMedia(const MTPMessageMedia &media) override; bool updateSentMedia(const MTPMessageMedia &media) override; +#endif std::unique_ptr createView( not_null message, not_null realParent, diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 055a62df4f7160..3aa0410fd9abcb 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -172,6 +172,7 @@ AllowedReactions Parse( }); } +#if 0 // mtp PeerData *PeerFromInputMTP( not_null owner, const MTPInputPeer &input) { @@ -205,6 +206,7 @@ UserData *UserFromInputMTP( return (UserData*)nullptr; }); } +#endif } // namespace Data @@ -867,6 +869,7 @@ void PeerData::setActionBar(const TLchatActionBar *bar) { }); } +#if 0 // mtp bool PeerData::changeColorIndex( const tl::conditional &cloudColorIndex) { return cloudColorIndex @@ -880,6 +883,7 @@ bool PeerData::changeBackgroundEmojiId( ? cloudBackgroundEmoji->v : DocumentId()); } +#endif void PeerData::fillNames() { _nameWords.clear(); diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 087e29e4970c78..0d7ca71bec7065 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -1216,6 +1216,19 @@ not_null Session::processUser(const TLuser &user) { } else { result->setEmojiStatus(0); } + auto decorationsUpdated = false; + if (result->changeColorIndex(data.vaccent_color_id().v)) { + updateFlags |= UpdateFlag::Color; + decorationsUpdated = true; + } + if (result->changeBackgroundEmojiId( + data.vbackground_custom_emoji_id().v)) { + updateFlags |= UpdateFlag::BackgroundEmoji; + decorationsUpdated = true; + } + if (decorationsUpdated && result->isMinimalLoaded()) { + _peerDecorationsUpdated.fire_copy(result); + } if (updateFlags) { session().changes().peerUpdated(result, updateFlags); @@ -1360,6 +1373,20 @@ not_null Session::processPeer(const TLchat &dialog) { session().sendAsPeers().setChosen(result, peerFromSender(*sender)); } + auto decorationsUpdated = false; + if (result->changeColorIndex(data.vaccent_color_id().v)) { + updates |= UpdateFlag::Color; + decorationsUpdated = true; + } + if (result->changeBackgroundEmojiId( + data.vbackground_custom_emoji_id().v)) { + updates |= UpdateFlag::BackgroundEmoji; + decorationsUpdated = true; + } + if (decorationsUpdated && result->isMinimalLoaded()) { + _peerDecorationsUpdated.fire_copy(result); + } + if (!result->isFullLoaded()) { result->setLoadedStatus(PeerData::LoadedStatus::Full); } @@ -2708,6 +2735,30 @@ void Session::applyChatPhoto(const TLDupdateChatPhoto &data) { } } +void Session::applyChatAccentColor(const TLDupdateChatAccentColor &data) { + if (const auto peer = peerLoaded(peerFromTdbChat(data.vchat_id()))) { + if (peer->changeColorIndex(data.vaccent_color_id().v)) { + peer->session().changes().peerUpdated( + peer, + PeerUpdate::Flag::Color); + _peerDecorationsUpdated.fire_copy(peer); + } + } +} + +void Session::applyChatBackgroundCustomEmoji( + const TLDupdateChatBackgroundCustomEmoji &data) { + if (const auto peer = peerLoaded(peerFromTdbChat(data.vchat_id()))) { + const auto id = data.vbackground_custom_emoji_id().v; + if (peer->changeBackgroundEmojiId(id)) { + peer->session().changes().peerUpdated( + peer, + PeerUpdate::Flag::BackgroundEmoji); + _peerDecorationsUpdated.fire_copy(peer); + } + } +} + bool Session::pinnedCanPin(not_null thread) const { if (const auto topic = thread->asTopic()) { const auto forum = topic->forum(); @@ -5389,6 +5440,7 @@ uint64 Session::wallpapersHash() const { return _wallpapersHash; } +#if 0 // mtp MTP::DcId Session::statsDcId(not_null channel) { const auto it = _channelStatsDcIds.find(channel); return (it == end(_channelStatsDcIds)) ? MTP::DcId(0) : it->second; @@ -5401,6 +5453,7 @@ void Session::applyStatsDcId( _channelStatsDcIds[channel] = dcId; } } +#endif void Session::webViewResultSent(WebViewResultSent &&sent) { return _webViewResultSent.fire(std::move(sent)); diff --git a/Telegram/SourceFiles/data/data_session.h b/Telegram/SourceFiles/data/data_session.h index a2726f2c53f23f..c35dd52579286d 100644 --- a/Telegram/SourceFiles/data/data_session.h +++ b/Telegram/SourceFiles/data/data_session.h @@ -44,6 +44,8 @@ class TLDupdateChatLastMessage; class TLDupdateChatPermissions; class TLDupdateChatTitle; class TLDupdateChatPhoto; +class TLDupdateChatAccentColor; +class TLDupdateChatBackgroundCustomEmoji; } // namespace Tdb enum class SimpleDocumentType; @@ -881,8 +883,10 @@ class Session final { [[nodiscard]] auto peerDecorationsUpdated() const -> rpl::producer>; +#if 0 // mtp void applyStatsDcId(not_null, MTP::DcId); [[nodiscard]] MTP::DcId statsDcId(not_null); +#endif void clearLocalStorage(); @@ -891,6 +895,9 @@ class Session final { void applyChatPermissions(const Tdb::TLDupdateChatPermissions &data); void applyChatTitle(const Tdb::TLDupdateChatTitle &data); void applyChatPhoto(const Tdb::TLDupdateChatPhoto &data); + void applyChatAccentColor(const Tdb::TLDupdateChatAccentColor &data); + void applyChatBackgroundCustomEmoji( + const Tdb::TLDupdateChatBackgroundCustomEmoji &data); private: using Messages = std::unordered_map>; @@ -1197,7 +1204,9 @@ class Session final { base::flat_map, TimeId> _watchingForOffline; base::Timer _watchForOfflineTimer; +#if 0 // mtp base::flat_map, MTP::DcId> _channelStatsDcIds; +#endif rpl::event_stream _webViewResultSent; diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 4c590db69e66a0..c65888211a5bfc 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -439,19 +439,16 @@ void HistoryItem::FillForwardedInfo( const TLDmessageForwardInfo &data) { config.originalDate = data.vdate().v; config.forwardPsaType = data.vpublic_service_announcement_type().v; - data.vorigin().match([&](const TLDmessageForwardOriginUser &data) { - config.senderOriginal = peerFromUser(data.vsender_user_id()); - }, [&](const TLDmessageForwardOriginChat &data) { - config.senderOriginal = peerFromTdbChat(data.vsender_chat_id()); - }, [&](const TLDmessageForwardOriginHiddenUser &data) { - config.senderNameOriginal = data.vsender_name().v; - }, [&](const TLDmessageForwardOriginChannel &data) { - config.senderOriginal = peerFromTdbChat(data.vchat_id()); + data.vorigin().match([&](const TLDmessageOriginUser &data) { + config.originalSenderId = peerFromUser(data.vsender_user_id()); + }, [&](const TLDmessageOriginChat &data) { + config.originalSenderId = peerFromTdbChat(data.vsender_chat_id()); + }, [&](const TLDmessageOriginHiddenUser &data) { + config.originalSenderName = data.vsender_name().v; + }, [&](const TLDmessageOriginChannel &data) { + config.originalSenderId = peerFromTdbChat(data.vchat_id()); config.originalId = data.vmessage_id().v; - config.authorOriginal = data.vauthor_signature().v; - }, [&](const TLDmessageForwardOriginMessageImport &data) { - config.senderNameOriginal = data.vsender_name().v; - config.imported = true; + config.originalPostAuthor = data.vauthor_signature().v; }); if (const auto savedFromMsgId = data.vfrom_message_id().v) { config.savedFromPeer = peerFromTdbChat(data.vfrom_chat_id()); @@ -459,6 +456,13 @@ void HistoryItem::FillForwardedInfo( } } +void HistoryItem::FillImportInfo( + CreateConfig &config, + const TLDmessageImportInfo &data) { + config.originalSenderName = data.vsender_name().v; + config.imported = true; +} + HistoryItem::HistoryItem( not_null history, MsgId id, @@ -475,22 +479,14 @@ HistoryItem::HistoryItem( if (const auto forwarded = data.vforward_info()) { FillForwardedInfo(config, forwarded->data()); } + if (const auto imported = data.vimport_info()) { + FillImportInfo(config, imported->data()); + } if (const auto replyTo = data.vreply_to()) { - config.replyToTop = data.vmessage_thread_id().v; - config.replyIsTopicPost = data.vis_topic_message().v; - replyTo->match([&](const TLDmessageReplyToMessage &data) { - config.replyToPeer = peerFromTdbChat(data.vchat_id()); - config.replyTo = data.vmessage_id().v; - }, [&](const TLDmessageReplyToStory &data) { - config.replyToPeer = peerFromTdbChat( - data.vstory_sender_chat_id()); - config.replyToStory = data.vstory_id().v; - }); - } else if (data.vis_topic_message().v) { - const auto threadId = data.vmessage_thread_id().v; - config.replyTo = config.replyToTop = threadId; - config.replyIsTopicPost = true; + config.reply = ReplyFieldsFromTL(this, *replyTo); } + config.reply.topMessageId = data.vmessage_thread_id().v; + config.reply.topicPost = data.vis_topic_message().v; config.viaBotId = data.vvia_bot_user_id().v; const auto interaction = data.vinteraction_info(); if (interaction) { @@ -508,7 +504,7 @@ HistoryItem::HistoryItem( } config.markup = HistoryMessageMarkupData(data.vreply_markup()); config.editDate = data.vedit_date().v; - config.author = data.vauthor_signature().v; + config.postAuthor = data.vauthor_signature().v; createComponents(std::move(config)); @@ -3697,8 +3693,8 @@ void HistoryItem::createServiceFromTdb(const TLmessageContent &content) { auto replyInPeerId = PeerId(); const auto reply = Get(); if (reply) { - replyToMsgId = reply->replyToMsgId; - replyInPeerId = reply->replyToPeerId; + replyToMsgId = reply->messageId(); + replyInPeerId = reply->externalPeerId(); reply->clearData(this); } RemoveComponents( @@ -4611,6 +4607,11 @@ void HistoryItem::setMedia(const TLmessageContent &content) { checkBuyButton(); } +void HistoryItem::setMediaExplicit(std::unique_ptr media) { + _media = std::move(media); + checkBuyButton(); +} + void HistoryItem::setContent(const TLmessageContent &content) { _flags &= ~(MessageFlag::IsGroupEssential | MessageFlag::IsContactSignUp diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index 416752697f024b..77cb88a42286ea 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -20,6 +20,7 @@ class TLmessage; class TLDmessage; class TLmessageContent; class TLDmessageForwardInfo; +class TLDmessageImportInfo; class TLmessageInteractionInfo; class TLmessageReaction; class TLunreadReaction; @@ -560,6 +561,7 @@ class HistoryItem final : public RuntimeComposer { void customEmojiRepaint(); void updateContent(const Tdb::TLmessageContent &content); + void setMediaExplicit(std::unique_ptr media); void updateInteractionInfo(const Tdb::TLmessageInteractionInfo *info); void updateEditedInfo( TimeId editDate, @@ -650,6 +652,9 @@ class HistoryItem final : public RuntimeComposer { static void FillForwardedInfo( CreateConfig &config, const Tdb::TLDmessageForwardInfo &data); + static void FillImportInfo( + CreateConfig &config, + const Tdb::TLDmessageImportInfo &data); void createServiceFromTdb(const Tdb::TLmessageContent &content); void setServiceMessageByContent(const Tdb::TLmessageContent &content); void applyContent(const Tdb::TLmessageContent &content); diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index a12e229a130b18..a3ef0f2818f448 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -51,10 +51,14 @@ For license and copyright information please follow this link: #include "styles/style_chat.h" #include "styles/style_dialogs.h" // dialogsMiniReplyStory. +#include "tdb/tdb_tl_scheme.h" + #include namespace { +using namespace Tdb; + const auto kPsaForwardedPrefix = "cloud_lng_forwarded_psa_"; } // namespace @@ -372,6 +376,44 @@ FullReplyTo ReplyToFromMTP( } #endif +ReplyFields ReplyFieldsFromTL( + not_null item, + const Tdb::TLmessageReplyTo &reply) { + return reply.match([&](const TLDmessageReplyToMessage &data) { + auto result = ReplyFields(); + result.messageId = data.vmessage_id().v; + const auto externalPeerId = peerFromTdbChat(data.vchat_id()); + if (externalPeerId != item->history()->peer->id) { + result.externalPeerId = externalPeerId; + } + if (const auto content = data.vcontent()) { + result.externalMedia = HistoryItem::CreateMedia(item, *content); + } + if (const auto quote = data.vquote()) { + result.quote = Api::FormattedTextFromTdb(*quote); + result.manualQuote = data.vis_quote_manual().v; + } + if (const auto origin = data.vorigin()) { + origin->match([&](const TLDmessageOriginUser &data) { + result.externalSenderId = peerFromUser(data.vsender_user_id()); + }, [&](const TLDmessageOriginChat &data) { + result.externalSenderId = peerFromTdbChat(data.vsender_chat_id()); + }, [&](const TLDmessageOriginHiddenUser &data) { + result.externalSenderName = data.vsender_name().v; + }, [&](const TLDmessageOriginChannel &data) { + result.externalSenderId = peerFromTdbChat(data.vchat_id()); + result.externalPostAuthor = data.vauthor_signature().v; + }); + } + return result; + }, [&](const TLDmessageReplyToStory &data) { + return ReplyFields{ + .externalPeerId = peerFromTdbChat(data.vstory_sender_chat_id()), + .storyId = data.vstory_id().v, + }; + }); +} + HistoryMessageReply::HistoryMessageReply() = default; HistoryMessageReply &HistoryMessageReply::operator=( diff --git a/Telegram/SourceFiles/history/history_item_components.h b/Telegram/SourceFiles/history/history_item_components.h index ca88ee15715e79..9ec40021a8eb6d 100644 --- a/Telegram/SourceFiles/history/history_item_components.h +++ b/Telegram/SourceFiles/history/history_item_components.h @@ -15,6 +15,10 @@ For license and copyright information please follow this link: #include "ui/effects/ripple_animation.h" #include "ui/chat/message_bubble.h" +namespace Tdb { +class TLmessageReplyTo; +} // namespace Tdb + struct WebPageData; class VoiceSeekClickHandler; @@ -269,6 +273,10 @@ struct ReplyFields { const MTPInputReplyTo &reply); #endif +[[nodiscard]] ReplyFields ReplyFieldsFromTL( + not_null item, + const Tdb::TLmessageReplyTo &reply); + struct HistoryMessageReply : public RuntimeComponent { HistoryMessageReply(); diff --git a/Telegram/SourceFiles/history/view/controls/history_view_draft_options.cpp b/Telegram/SourceFiles/history/view/controls/history_view_draft_options.cpp index 18edcd0c460f8c..eff6d47ee2d553 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_draft_options.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_draft_options.cpp @@ -272,6 +272,7 @@ rpl::producer PreviewWrap::showLinkSelector( message.text, TextUtilities::ConvertTextTagsToEntities(message.tags), }, links), +#if 0 // mtp MTP_messageMediaWebPage( MTP_flags(Flag() | (webpage.forceLargeMedia @@ -287,8 +288,19 @@ rpl::producer PreviewWrap::showLinkSelector( MTP_long(webpage.id), MTP_string(webpage.url), MTP_int(0))), +#endif HistoryMessageMarkupData(), uint64(0)); // groupedId + _draftItem->setMediaExplicit(std::make_unique( + _draftItem, + _history->owner().webpage(webpage.id), + (MediaWebPageFlag::Manual + | (webpage.forceLargeMedia + ? MediaWebPageFlag::ForceLargeMedia + : MediaWebPageFlag()) + | (webpage.forceSmallMedia + ? MediaWebPageFlag::ForceSmallMedia + : MediaWebPageFlag())))); _element = _draftItem->createView(_delegate.get()); _selectType = TextSelectType::Letters; _symbol = _selectionStartSymbol = 0; diff --git a/Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp b/Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp index f65613ea3fff5a..d3adf92e63772e 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp @@ -51,10 +51,18 @@ namespace { } // namespace +#if 0 // mtp Giveaway::Giveaway( not_null parent, not_null giveaway) : Media(parent) +#endif +Giveaway::Giveaway( + not_null parent, + not_null giveaway, + DocumentData *sticker) +: Media(parent) +, _document(sticker) , _prizesTitle(st::msgMinWidth) , _prizes(st::msgMinWidth) , _participantsTitle(st::msgMinWidth) @@ -400,9 +408,12 @@ void Giveaway::ensureStickerCreated() const { if (_sticker) { return; } +#if 0 // mtp const auto &session = _parent->history()->session(); auto &packs = session.giftBoxStickersPacks(); if (const auto document = packs.lookup(_months)) { +#endif + if (const auto document = _document) { if (const auto sticker = document->sticker()) { const auto skipPremiumEffect = false; _sticker.emplace(_parent, document, skipPremiumEffect, _parent); diff --git a/Telegram/SourceFiles/history/view/media/history_view_giveaway.h b/Telegram/SourceFiles/history/view/media/history_view_giveaway.h index 250e214c299abd..b4fa366c5a91fe 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_giveaway.h +++ b/Telegram/SourceFiles/history/view/media/history_view_giveaway.h @@ -26,9 +26,15 @@ namespace HistoryView { class Giveaway final : public Media { public: +#if 0 // mtp Giveaway( not_null parent, not_null giveaway); +#endif + Giveaway( + not_null parent, + not_null giveaway, + DocumentData *sticker); ~Giveaway(); void draw(Painter &p, const PaintContext &context) const override; @@ -86,6 +92,7 @@ class Giveaway final : public Media { [[nodiscard]] QMargins inBubblePadding() const; + DocumentData *_document = nullptr; mutable std::optional _sticker; Ui::Text::String _prizesTitle; diff --git a/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.cpp b/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.cpp index 975dab5b3e1208..8315ae09163296 100644 --- a/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.cpp +++ b/Telegram/SourceFiles/info/boosts/giveaway/giveaway_list_controllers.cpp @@ -244,6 +244,7 @@ Main::Session &MyChannelsListController::session() const { void MyChannelsListController::prepare() { delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled); +#if 0 // todo const auto api = _apiLifetime.make_state( &session().api().instance()); api->request( @@ -285,6 +286,7 @@ void MyChannelsListController::prepare() { delegate()->peerListRefreshRows(); _selected.clear(); }).send(); +#endif } void MyChannelsListController::setCheckError(Fn callback) { diff --git a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp index c8c1d28e4f6499..ddaa3b10a62e64 100644 --- a/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp +++ b/Telegram/SourceFiles/inline_bots/bot_attach_web_view.cpp @@ -935,7 +935,7 @@ void AttachWebView::request(const WebViewButton &button) { tl_string(_startCommand.isEmpty() ? button.url : _startCommand), Window::Theme::WebViewTheme(), tl_string("tdesktop"), - tl_int53(action.replyTo.topicRootId.bare), + MessageThreadId(action.history->peer, action), MessageReplyTo(action) )).done([=](const TLwebAppInfo &result) { _requestId = 0; @@ -1394,7 +1394,7 @@ void AttachWebView::requestMenu( tl_string(url), Window::Theme::WebViewTheme(), tl_string("tdesktop"), - tl_int53(action.replyTo.topicRootId.bare), + MessageThreadId(action.history->peer, action), MessageReplyTo(action) )).done([=](const TLwebAppInfo &result) { _requestId = 0; diff --git a/Telegram/SourceFiles/main/main_app_config.cpp b/Telegram/SourceFiles/main/main_app_config.cpp index d8608c5367cec5..4ee06f8f8ee534 100644 --- a/Telegram/SourceFiles/main/main_app_config.cpp +++ b/Telegram/SourceFiles/main/main_app_config.cpp @@ -10,7 +10,9 @@ For license and copyright information please follow this link: #include "apiwrap.h" #include "base/call_delayed.h" #include "main/main_account.h" +#if 0 // mtp #include "ui/chat/chat_style.h" +#endif #include "tdb/tdb_tl_scheme.h" #include "main/main_session.h" @@ -307,6 +309,7 @@ std::vector> AppConfig::getStringMapArray( }); } +#if 0 // mtp std::vector AppConfig::getIntArray( const QString &key, std::vector &&fallback) const { @@ -327,6 +330,7 @@ std::vector AppConfig::getIntArray( }); }); } +#endif bool AppConfig::suggestionCurrent(const QString &key) const { return !_dismissedSuggestions.contains(key) @@ -358,6 +362,7 @@ void AppConfig::dismissSuggestion(const QString &key) { #endif } +#if 0 // mtp void AppConfig::parseColorIndices() { constexpr auto parseColor = [](const MTPJSONValue &color) { if (color.type() != mtpc_jsonString) { @@ -474,5 +479,6 @@ auto AppConfig::colorIndicesValue() const return *_colorIndicesCurrent; })); } +#endif } // namespace Main diff --git a/Telegram/SourceFiles/main/main_app_config.h b/Telegram/SourceFiles/main/main_app_config.h index 1ca772cf16bcf8..f2593983736c7e 100644 --- a/Telegram/SourceFiles/main/main_app_config.h +++ b/Telegram/SourceFiles/main/main_app_config.h @@ -16,9 +16,11 @@ namespace Tdb { class TLjsonValue; } // namespace Tdb +#if 0 // mtp namespace Ui { struct ColorIndicesCompressed; } // namespace Ui +#endif namespace Main { @@ -41,8 +43,10 @@ class AppConfig final { return getString(key, fallback); } else if constexpr (std::is_same_v>) { return getStringArray(key, std::move(fallback)); +#if 0 // mtp } else if constexpr (std::is_same_v>) { return getIntArray(key, std::move(fallback)); +#endif } else if constexpr (std::is_same_v< Type, std::vector>>) { @@ -60,14 +64,18 @@ class AppConfig final { const QString &key) const; void dismissSuggestion(const QString &key); +#if 0 // mtp [[nodiscard]] auto colorIndicesValue() const -> rpl::producer; +#endif void refresh(); private: void refreshDelayed(); +#if 0 // mtp void parseColorIndices(); +#endif template [[nodiscard]] auto getValue( @@ -106,8 +114,10 @@ class AppConfig final { rpl::event_stream<> _refreshed; base::flat_set _dismissedSuggestions; +#if 0 // mtp rpl::event_stream<> _colorIndicesChanged; std::unique_ptr _colorIndicesCurrent; +#endif rpl::lifetime _lifetime; diff --git a/Telegram/SourceFiles/main/main_session.cpp b/Telegram/SourceFiles/main/main_session.cpp index eb065f8daccf54..8fe6a179515d43 100644 --- a/Telegram/SourceFiles/main/main_session.cpp +++ b/Telegram/SourceFiles/main/main_session.cpp @@ -49,6 +49,7 @@ For license and copyright information please follow this link: #include "tdb/tdb_tl_scheme.h" #include "tdb/tdb_option.h" #include "api/api_global_privacy.h" +#include "ui/chat/chat_style.h" #ifndef TDESKTOP_DISABLE_SPELLCHECK #include "chat_helpers/spellchecker_common.h" @@ -552,9 +553,101 @@ Window::SessionController *Session::tryResolveWindow() const { return _windows.front(); } +void Session::applyAccentColors(const TLDupdateAccentColors &update) { +#if 0 + constexpr auto parseColor = [](const MTPJSONValue &color) { + if (color.type() != mtpc_jsonString) { + LOG(("API Error: Bad type for color element.")); + return uint32(); + } + const auto value = color.c_jsonString().vvalue().v; + if (value.size() != 6) { + LOG(("API Error: Bad length for color element: %1" + ).arg(qs(value))); + return uint32(); + } + const auto hex = [](char ch) { + return (ch >= 'a' && ch <= 'f') + ? (ch - 'a' + 10) + : (ch >= 'A' && ch <= 'F') + ? (ch - 'A' + 10) + : (ch >= '0' && ch <= '9') + ? (ch - '0') + : 0; + }; + auto result = (uint32(1) << 24); + for (auto i = 0; i != 6; ++i) { + result |= (uint32(hex(value[i])) << ((5 - i) * 4)); + } + return result; + }; +#endif + using ThemeColors = std::array; + constexpr auto parseColors = [](const TLvector &values) { + const auto &list = values.v; + const auto count = int(list.size()); + if (count > Ui::kColorPatternsCount) { + LOG(("API Error: Bad accentColor list size: %1").arg(count)); + return ThemeColors(); + } + auto result = ThemeColors(); + for (auto i = 0; i != count; ++i) { + result[i] = list[i].v; + } + return result; + }; + const auto parseColorIndex = [](const TLDaccentColor &data) { + return Ui::ColorIndexData{ + .light = parseColors(data.vlight_theme_colors()), + .dark = parseColors(data.vdark_theme_colors()), + }; + }; + auto colors = std::make_shared< + std::array>(); + for (const auto &color : update.vcolors().v) { + const auto &data = color.data(); + const auto index = data.vid().v; + if (index < Ui::kSimpleColorIndexCount + || index >= Ui::kColorIndexCount) { + LOG(("API Error: Bad index for accentColor: %1").arg(index)); + continue; + } + (*colors)[index] = parseColorIndex(data); + } + + if (!_colorIndicesCurrent) { + _colorIndicesCurrent = std::make_unique( + Ui::ColorIndicesCompressed{ std::move(colors) }); + _colorIndicesChanged.fire({}); + } else if (*_colorIndicesCurrent->colors != *colors) { + _colorIndicesCurrent->colors = std::move(colors); + _colorIndicesChanged.fire({}); + } + + _availableColorIndices = update.vavailable_accent_color_ids().v + | ranges::views::transform([](TLint32 v) { return uint8(v.v); }) + | ranges::to_vector; +} + auto Session::colorIndicesValue() const -> rpl::producer { +#if 0 // mtp return _account->appConfig().colorIndicesValue(); +#endif + return rpl::single(_colorIndicesCurrent + ? *_colorIndicesCurrent + : Ui::ColorIndicesCompressed() + ) | rpl::then(_colorIndicesChanged.events() | rpl::map([=] { + return *_colorIndicesCurrent; + })); +} + +auto Session::availableColorIndicesValue() const +-> rpl::producer> { + if (_availableColorIndices.current().empty()) { + _availableColorIndices = std::vector{ 0, 1, 2, 3, 4, 5, 6 }; + } + return _availableColorIndices.value(); } } // namespace Main diff --git a/Telegram/SourceFiles/main/main_session.h b/Telegram/SourceFiles/main/main_session.h index 736abdcc5f034b..d9fca30b508c7d 100644 --- a/Telegram/SourceFiles/main/main_session.h +++ b/Telegram/SourceFiles/main/main_session.h @@ -20,6 +20,7 @@ class Account; class Sender; class TLDupdateOption; class TLmessage; +class TLDupdateAccentColors; } // namespace Tdb namespace Api { @@ -219,8 +220,11 @@ class Session final : public base::has_weak_ptr { [[nodiscard]] Support::Helper &supportHelper() const; [[nodiscard]] Support::Templates &supportTemplates() const; + void applyAccentColors(const Tdb::TLDupdateAccentColors &update); [[nodiscard]] auto colorIndicesValue() const -> rpl::producer; + [[nodiscard]] auto availableColorIndicesValue() const + -> rpl::producer>; private: static constexpr auto kDefaultSaveDelay = crl::time(1000); @@ -265,12 +269,15 @@ class Session final : public base::has_weak_ptr { base::flat_set> _windows; base::Timer _saveSettingsTimer; + rpl::event_stream<> _colorIndicesChanged; + std::unique_ptr _colorIndicesCurrent; + mutable rpl::variable> _availableColorIndices; #if 0 // goodToRemove QByteArray _tmpPassword; TimeId _tmpPasswordValidUntil = 0; -#endif rpl::event_stream _colorIndicesChanges; +#endif rpl::lifetime _lifetime; diff --git a/Telegram/SourceFiles/media/stories/media_stories_share.cpp b/Telegram/SourceFiles/media/stories/media_stories_share.cpp index 99b7c4898c21a4..0da536891869ef 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_share.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_share.cpp @@ -151,7 +151,8 @@ using namespace Tdb; tl_bool(true), // from_background. tl_bool(false), // update_order_of_installed_stickers_sets Api::ScheduledToTL(action.options.scheduled), - tl_int32(0)); + tl_int32(0), // sending_id + tl_bool(false)); // only_preview sender.request(TLsendMessage( peerToTdbChat(threadPeer->id), tl_int53(action.replyTo.topicRootId.bare), diff --git a/Telegram/SourceFiles/payments/payments_form.cpp b/Telegram/SourceFiles/payments/payments_form.cpp index e7cb8354c10d0b..a2156e669f0875 100644 --- a/Telegram/SourceFiles/payments/payments_form.cpp +++ b/Telegram/SourceFiles/payments/payments_form.cpp @@ -178,6 +178,7 @@ not_null SessionFromId(const InvoiceId &id) { return &giveaway.boostPeer->session(); } +#if 0 // mtp MTPinputStorePaymentPurpose InvoicePremiumGiftCodeGiveawayToTL( const InvoicePremiumGiftCode &invoice) { const auto &giveaway = v::get( @@ -210,6 +211,7 @@ MTPinputStorePaymentPurpose InvoicePremiumGiftCodeGiveawayToTL( MTP_string(invoice.currency), MTP_long(invoice.amount)); } +#endif Form::Form(InvoiceId id, bool receipt) : _id(id) diff --git a/Telegram/SourceFiles/payments/payments_form.h b/Telegram/SourceFiles/payments/payments_form.h index d9d3aeb0e230a3..2974b51d53d1fe 100644 --- a/Telegram/SourceFiles/payments/payments_form.h +++ b/Telegram/SourceFiles/payments/payments_form.h @@ -242,8 +242,10 @@ struct InvoiceId { [[nodiscard]] not_null SessionFromId(const InvoiceId &id); +#if 0 // mtp [[nodiscard]] MTPinputStorePaymentPurpose InvoicePremiumGiftCodeGiveawayToTL( const InvoicePremiumGiftCode &invoice); +#endif class Form final : public base::has_weak_ptr { public: diff --git a/Telegram/SourceFiles/support/support_autocomplete.cpp b/Telegram/SourceFiles/support/support_autocomplete.cpp index 8d3f57def92b7f..1cc5b701f929e1 100644 --- a/Telegram/SourceFiles/support/support_autocomplete.cpp +++ b/Telegram/SourceFiles/support/support_autocomplete.cpp @@ -340,6 +340,7 @@ AdminLog::OwnedItem GenerateContactItem( tl_bool(false), // is_pinned tl_bool(false), // can_be_edited tl_bool(false), // can_be_forwarded + tl_bool(false), // can_be_replied_in_another_chat tl_bool(true), // can_be_saved tl_bool(true), // can_be_deleted_only_for_self tl_bool(false), // can_be_deleted_for_all_users @@ -356,12 +357,13 @@ AdminLog::OwnedItem GenerateContactItem( tl_int32(base::unixtime::now()), // date tl_int32(0), // edit_date tl_messageForwardInfo( - tl_messageForwardOriginUser( + tl_messageOriginUser( tl_int53(history->session().userId().bare)), tl_int32(base::unixtime::now()), // date tl_string(), // public_service_announcement_type peerToTdbChat(history->session().userPeerId()), tl_int53(0)), // from_message_id + std::nullopt, // import_info std::nullopt, // interaction_info tl_vector(), // unread_reactions std::nullopt, // reply_to diff --git a/Telegram/SourceFiles/tdb/td_api.tl b/Telegram/SourceFiles/tdb/td_api.tl index 8e89e9cbd68b2f..dce632617a8e54 100644 --- a/Telegram/SourceFiles/tdb/td_api.tl +++ b/Telegram/SourceFiles/tdb/td_api.tl @@ -117,7 +117,7 @@ textEntities entities:vector = TextEntities; //@description A text with some entities //@text The text //@entities Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. -//-Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other +//-Pre, Code and PreCode entities can't contain other entities. BlockQuote entities can't contain other BlockQuote entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other formattedText text:string entities:vector = FormattedText; @@ -689,11 +689,11 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; //@description Describes actions that a user is allowed to take in a chat -//@can_send_basic_messages True, if the user can send text messages, contacts, invoices, locations, and venues +//@can_send_basic_messages True, if the user can send text messages, contacts, giveaways, invoices, locations, and venues //@can_send_audios True, if the user can send music files //@can_send_documents True, if the user can send documents -//@can_send_photos True, if the user can send audio photos -//@can_send_videos True, if the user can send audio videos +//@can_send_photos True, if the user can send photos +//@can_send_videos True, if the user can send videos //@can_send_video_notes True, if the user can send video notes //@can_send_voice_notes True, if the user can send voice notes //@can_send_polls True, if the user can send polls @@ -706,14 +706,13 @@ inputChatPhotoSticker sticker:chatPhotoSticker = InputChatPhoto; chatPermissions can_send_basic_messages:Bool can_send_audios:Bool can_send_documents:Bool can_send_photos:Bool can_send_videos:Bool can_send_video_notes:Bool can_send_voice_notes:Bool can_send_polls:Bool can_send_other_messages:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool can_manage_topics:Bool = ChatPermissions; //@description Describes rights of the administrator -//@can_manage_chat True, if the administrator can get chat event log, get chat statistics, get chat boosts in channels, get message statistics in channels, get channel members, -//-see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only +//@can_manage_chat True, if the administrator can get chat event log, get chat boosts in channels, get channel members, report supergroup spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only //@can_change_info True, if the administrator can change the chat title, photo, and other settings -//@can_post_messages True, if the administrator can create channel posts; applicable to channels only +//@can_post_messages True, if the administrator can create channel posts or view channel statistics; applicable to channels only //@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat -//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members; always true for channels +//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members or view supergroup statistics; always true for channels //@can_pin_messages True, if the administrator can pin messages; applicable to basic groups and supergroups only //@can_manage_topics True, if the administrator can manage topics; applicable to forum supergroups only //@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them @@ -741,6 +740,77 @@ premiumPaymentOption currency:string amount:int53 discount_percentage:int32 mont //@last_transaction_id Identifier of the last in-store transaction for the currently used option premiumStatePaymentOption payment_option:premiumPaymentOption is_current:Bool is_upgrade:Bool last_transaction_id:string = PremiumStatePaymentOption; +//@description Describes an option for creating Telegram Premium gift codes +//@currency ISO 4217 currency code for Telegram Premium gift code payment +//@amount The amount to pay, in the smallest units of the currency +//@user_count Number of users which will be able to activate the gift codes +//@month_count Number of month the Telegram Premium subscription will be active +//@store_product_id Identifier of the store product associated with the option; may be empty if none +//@store_product_quantity Number of times the store product must be paid +premiumGiftCodePaymentOption currency:string amount:int53 user_count:int32 month_count:int32 store_product_id:string store_product_quantity:int32 = PremiumGiftCodePaymentOption; + +//@description Contains a list of options for creating Telegram Premium gift codes +//@options The list of options +premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; + +//@description Contains information about a Telegram Premium gift code +//@creator_id Identifier of a chat or a user that created the gift code +//@creation_date Point in time (Unix timestamp) when the code was created +//@is_from_giveaway True, if the gift code was created for a giveaway +//@giveaway_message_id Identifier of the corresponding giveaway message in the creator_id chat; can be 0 or an identifier of a deleted message +//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@user_id Identifier of a user for which the code was created; 0 if none +//@use_date Point in time (Unix timestamp) when the code was activated; 0 if none +premiumGiftCodeInfo creator_id:MessageSender creation_date:int32 is_from_giveaway:Bool giveaway_message_id:int53 month_count:int32 user_id:int53 use_date:int32 = PremiumGiftCodeInfo; + + +//@class PremiumGiveawayParticipantStatus +//@description Contains information about status of a user in a Telegram Premium giveaway + +//@description The user is eligible for the giveaway +premiumGiveawayParticipantStatusEligible = PremiumGiveawayParticipantStatus; + +//@description The user participates in the giveaway +premiumGiveawayParticipantStatusParticipating = PremiumGiveawayParticipantStatus; + +//@description The user can't participate in the giveaway, because they have already been member of the chat +//@joined_chat_date Point in time (Unix timestamp) when the user joined the chat +premiumGiveawayParticipantStatusAlreadyWasMember joined_chat_date:int32 = PremiumGiveawayParticipantStatus; + +//@description The user can't participate in the giveaway, because they are an administrator in one of the chats that created the giveaway +//@chat_id Identifier of the chat administered by the user +premiumGiveawayParticipantStatusAdministrator chat_id:int53 = PremiumGiveawayParticipantStatus; + +//@description The user can't participate in the giveaway, because they phone number is from a disallowed country +//@user_country_code A two-letter ISO 3166-1 alpha-2 country code of the user's country +premiumGiveawayParticipantStatusDisallowedCountry user_country_code:string = PremiumGiveawayParticipantStatus; + + +//@class PremiumGiveawayInfo +//@description Contains information about Telegram Premium giveaway + +//@description Describes an ongoing giveaway +//@creation_date Point in time (Unix timestamp) when the giveaway was created +//@status Status of the current user in the giveaway +//@is_ended True, if the giveaway has ended and results are being prepared +premiumGiveawayInfoOngoing creation_date:int32 status:PremiumGiveawayParticipantStatus is_ended:Bool = PremiumGiveawayInfo; + +//@description Describes a completed giveaway +//@creation_date Point in time (Unix timestamp) when the giveaway was created +//@actual_winners_selection_date Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway +//@was_refunded True, if the giveaway was canceled and was fully refunded +//@winner_count Number of winners in the giveaway +//@activation_count Number of winners, which activated their gift codes +//@gift_code Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway +premiumGiveawayInfoCompleted creation_date:int32 actual_winners_selection_date:int32 was_refunded:Bool winner_count:int32 activation_count:int32 gift_code:string = PremiumGiveawayInfo; + + +//@description Contains information about supported accent color for user/chat name, background of empty chat photo, replies to messages and link previews +//@id Accent color identifier +//@built_in_accent_color_id Identifier of a built-in color to use in places, where only one color is needed; 0-6 +//@light_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes +//@dark_theme_colors The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes +accentColor id:int32 built_in_accent_color_id:int32 light_theme_colors:vector dark_theme_colors:vector = AccentColor; //@description Describes a custom emoji to be shown instead of the Telegram Premium badge //@custom_emoji_id Identifier of the custom emoji in stickerFormatTgs format @@ -767,6 +837,8 @@ usernames active_usernames:vector disabled_usernames:vector edit //@phone_number Phone number of the user //@status Current online status of the user //@profile_photo Profile photo of the user; may be null +//@accent_color_id Identifier of the accent color for name, and backgrounds of profile photo, reply header, and link preview +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none. For Telegram Premium users only //@emoji_status Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only //@is_contact The user is a contact of the current user //@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user @@ -783,7 +855,7 @@ usernames active_usernames:vector disabled_usernames:vector edit //@type Type of the user //@language_code IETF language tag of the user's language; only available to bots //@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots -user id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; +user id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User; //@description Contains information about a bot @@ -1007,6 +1079,7 @@ inviteLinkChatTypeChannel = InviteLinkChatType; //@type Type of the chat //@title Title of the chat //@photo Chat photo; may be null +//@accent_color_id Identifier of the accent color for chat title and background of chat photo //@param_description Chat description //@member_count Number of members in the chat //@member_user_ids User identifiers of some chat members that may be known to the current user @@ -1015,7 +1088,7 @@ inviteLinkChatTypeChannel = InviteLinkChatType; //@is_verified True, if the chat is verified //@is_scam True, if many users reported this chat as a scam //@is_fake True, if many users reported this chat as a fake account -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:InviteLinkChatType title:string photo:chatPhotoInfo accent_color_id:int32 description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; //@description Describes a user that sent a join request and waits for administrator approval @@ -1155,7 +1228,7 @@ messageSenders total_count:int32 senders:vector = MessageSenders; //@description Represents a message sender, which can be used to send messages in a chat -//@sender Available message senders +//@sender The message sender //@needs_premium True, if Telegram Premium is needed to use the message sender chatMessageSender sender:MessageSender needs_premium:Bool = ChatMessageSender; @@ -1174,31 +1247,27 @@ messageViewer user_id:int53 view_date:int32 = MessageViewer; messageViewers viewers:vector = MessageViewers; -//@class MessageForwardOrigin -//@description Contains information about the origin of a forwarded message +//@class MessageOrigin +//@description Contains information about the origin of a message //@description The message was originally sent by a known user //@sender_user_id Identifier of the user that originally sent the message -messageForwardOriginUser sender_user_id:int53 = MessageForwardOrigin; +messageOriginUser sender_user_id:int53 = MessageOrigin; + +//@description The message was originally sent by a user, which is hidden by their privacy settings +//@sender_name Name of the sender +messageOriginHiddenUser sender_name:string = MessageOrigin; //@description The message was originally sent on behalf of a chat //@sender_chat_id Identifier of the chat that originally sent the message //@author_signature For messages originally sent by an anonymous chat administrator, original message author signature -messageForwardOriginChat sender_chat_id:int53 author_signature:string = MessageForwardOrigin; - -//@description The message was originally sent by a user, which is hidden by their privacy settings -//@sender_name Name of the sender -messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin; +messageOriginChat sender_chat_id:int53 author_signature:string = MessageOrigin; //@description The message was originally a post in a channel -//@chat_id Identifier of the chat from which the message was originally forwarded +//@chat_id Identifier of the channel chat to which the message was originally sent //@message_id Message identifier of the original message //@author_signature Original post author signature -messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin; - -//@description The message was imported from an exported message history -//@sender_name Name of the sender -messageForwardOriginMessageImport sender_name:string = MessageForwardOrigin; +messageOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageOrigin; //@class ReactionType @@ -1214,12 +1283,17 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType; //@description Contains information about a forwarded message -//@origin Origin of a forwarded message +//@origin Origin of the forwarded message //@date Point in time (Unix timestamp) when the message was originally sent //@public_service_announcement_type The type of a public service announcement for the forwarded message //@from_chat_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown //@from_message_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown -messageForwardInfo origin:MessageForwardOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; +messageForwardInfo origin:MessageOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; + +//@description Contains information about a message created with importMessages +//@sender_name Name of the original sender +//@date Point in time (Unix timestamp) when the message was originally sent +messageImportInfo sender_name:string date:int32 = MessageImportInfo; //@description Contains information about replies to a message //@reply_count Number of times the message was directly or indirectly replied @@ -1233,8 +1307,10 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@type Type of the reaction //@total_count Number of times the reaction was added //@is_chosen True, if the reaction is chosen by the current user +//@used_sender_id Identifier of the message sender used by the current user to add the reaction; may be null if unknown or the reaction isn't chosen //@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats -messageReaction type:ReactionType total_count:int32 is_chosen:Bool recent_sender_ids:vector = MessageReaction; +messageReaction type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; + //@description Contains information about interactions with a message //@view_count Number of times the message was viewed @@ -1261,24 +1337,49 @@ messageSendingStatePending sending_id:int32 = MessageSendingState; //@error The cause of the message sending failure //@can_retry True, if the message can be re-sent //@need_another_sender True, if the message can be re-sent only on behalf of a different sender +//@need_another_reply_quote True, if the message can be re-sent only if another quote is chosen in the message that is replied by the given message +//@need_drop_reply True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages //@retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes -messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool retry_after:double = MessageSendingState; +messageSendingStateFailed error:error can_retry:Bool need_another_sender:Bool need_another_reply_quote:Bool need_drop_reply:Bool retry_after:double = MessageSendingState; //@class MessageReplyTo //@description Contains information about the message or the story a message is replying to -//@description Describes a replied message -//@chat_id The identifier of the chat to which the replied message belongs; ignored for outgoing replies. For example, messages in the Replies chat are replies to messages in different chats -//@message_id The identifier of the replied message -messageReplyToMessage chat_id:int53 message_id:int53 = MessageReplyTo; - -//@description Describes a replied story -//@story_sender_chat_id The identifier of the sender of the replied story. Currently, stories can be replied only in the sender's chat -//@story_id The identifier of the replied story +//@description Describes a message replied by a given message +//@chat_id The identifier of the chat to which the message belongs; may be 0 if the replied message is in unknown chat +//@message_id The identifier of the message; may be 0 if the replied message is in unknown chat +//@quote Manually or automatically chosen quote from the replied message; may be null if none. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the quote +//@is_quote_manual True, if the quote was manually chosen by the message sender +//@origin Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat +//@origin_send_date Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat +//@content Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. +//-Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, +//-messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote +messageReplyToMessage chat_id:int53 message_id:int53 quote:formattedText is_quote_manual:Bool origin:MessageOrigin origin_send_date:int32 content:MessageContent = MessageReplyTo; + +//@description Describes a story replied by a given message +//@story_sender_chat_id The identifier of the sender of the story +//@story_id The identifier of the story messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; +//@class InputMessageReplyTo +//@description Contains information about the message or the story to be replied + +//@description Describes a message to be replied +//@chat_id The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat or topic only if message.can_be_replied_in_another_chat +//@message_id The identifier of the message to be replied in the same or the specified chat +//@quote Manually chosen quote from the message to be replied; pass null if none; 0-getOption("message_reply_quote_length_max") characters. Must always be null for replies in secret chats. +//-Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote +inputMessageReplyToMessage chat_id:int53 message_id:int53 quote:formattedText = InputMessageReplyTo; + +//@description Describes a story to be replied +//@story_sender_chat_id The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat +//@story_id The identifier of the story +inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessageReplyTo; + + //@description Describes a message //@id Message identifier; unique for the chat to which the message belongs //@sender_id Identifier of the sender of the message @@ -1289,6 +1390,7 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@is_pinned True, if the message is pinned //@can_be_edited True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application //@can_be_forwarded True, if the message can be forwarded +//@can_be_replied_in_another_chat True, if the message can be replied in another chat or topic //@can_be_saved True, if content of the message can be saved locally or copied //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it //@can_be_deleted_for_all_users True, if the message can be deleted for all users @@ -1305,12 +1407,13 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@date Point in time (Unix timestamp) when the message was sent //@edit_date Point in time (Unix timestamp) when the message was last edited //@forward_info Information about the initial message sender; may be null if none or unknown +//@import_info Information about the initial message for messages created with importMessages; may be null if the message isn't imported //@interaction_info Information about interactions with the message; may be null if none //@unread_reactions Information about unread reactions added to the message //@reply_to Information about the message or the story this message is replying to; may be null if none //@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs //@self_destruct_type The message's self-destruct type; may be null if none -//@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-desctruction isn't scheduled yet +//@self_destruct_in Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet //@auto_delete_in Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never //@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent //@author_signature For channel posts and anonymous group messages, optional author signature @@ -1318,7 +1421,7 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo; //@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@content Content of the message //@reply_markup Reply markup for the message; may be null if none -message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages //@total_count Approximate total number of messages found @@ -1504,10 +1607,10 @@ scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool use_de //@description Contains information about a message draft -//@reply_to_message_id Identifier of the replied message; 0 if none +//@reply_to Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none //@date Point in time (Unix timestamp) when the draft was created //@input_message_text Content of the message draft; must be of the type inputMessageText -draftMessage reply_to_message_id:int53 date:int32 input_message_text:InputMessageContent = DraftMessage; +draftMessage reply_to:InputMessageReplyTo date:int32 input_message_text:InputMessageContent = DraftMessage; //@class ChatType @@ -1528,7 +1631,7 @@ chatTypeSupergroup supergroup_id:int53 is_channel:Bool = ChatType; //@description A secret chat with a user //@secret_chat_id Secret chat identifier -//@user_id User identifier of the secret chat peer +//@user_id User identifier of the other user in the secret chat chatTypeSecret secret_chat_id:int32 user_id:int53 = ChatType; @@ -1655,6 +1758,8 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@type Type of the chat //@title Chat title //@photo Chat photo; may be null +//@accent_color_id Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background in replies to messages sent by the chat; 0 if none //@permissions Actions that non-administrator chat members are allowed to take in the chat //@last_message Last message in the chat; may be null if none or unknown //@positions Positions of the chat in chat lists @@ -1684,7 +1789,7 @@ videoChat group_call_id:int32 has_participants:Bool default_participant_id:Messa //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null if none //@client_data Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used -chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhotoInfo accent_color_id:int32 background_custom_emoji_id:int64 permissions:chatPermissions last_message:message positions:vector message_sender_id:MessageSender block_list:BlockList has_protected_content:Bool is_translatable:Bool is_marked_as_unread:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 unread_reaction_count:int32 notification_settings:chatNotificationSettings available_reactions:ChatAvailableReactions message_auto_delete_time:int32 background:chatBackground theme_name:string action_bar:ChatActionBar video_chat:videoChat pending_join_requests:chatJoinRequestsInfo reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats //@total_count Approximate total number of chats found @@ -1729,7 +1834,7 @@ chatActionBarInviteMembers = ChatActionBar; //@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, //-or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown //@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings -//@distance If non-negative, the current user was found by the peer through searchChatsNearby and this is the distance between the users +//@distance If non-negative, the current user was found by the other user through searchChatsNearby and this is the distance between the users chatActionBarReportAddBlock can_unarchive:Bool distance:int32 = ChatActionBar; //@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact @@ -1885,10 +1990,9 @@ loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int53 reque //@description Contains information about a Web App found by its short name //@web_app The Web App -//@supports_settings True, if the app supports "settings_button_pressed" event //@request_write_access True, if the user must be asked for the permission to the bot to send them messages //@skip_confirmation True, if there is no need to show an ordinary open URL confirmation before opening the Web App. The field must be ignored and confirmation must be shown anyway if the Web App link was hidden -foundWebApp web_app:webApp supports_settings:Bool request_write_access:Bool skip_confirmation:Bool = FoundWebApp; +foundWebApp web_app:webApp request_write_access:Bool skip_confirmation:Bool = FoundWebApp; //@description Contains information about a Web App //@launch_id Unique identifier for the Web App launch @@ -1945,6 +2049,15 @@ forumTopic info:forumTopicInfo last_message:message is_pinned:Bool unread_count: forumTopics total_count:int32 topics:vector next_offset_date:int32 next_offset_message_id:int53 next_offset_message_thread_id:int53 = ForumTopics; +//@description Options to be used for generation of a link preview +//@is_disabled True, if link preview must be disabled +//@url URL to use for link preview. If empty, then the first URL found in the message text will be used +//@force_small_media True, if shown media preview must be small; ignored in secret chats or if the URL isn't explicitly specified +//@force_large_media True, if shown media preview must be large; ignored in secret chats or if the URL isn't explicitly specified +//@show_above_text True, if link preview must be shown above message text; otherwise, the link preview will be shown below the message text; ignored in secret chats +linkPreviewOptions is_disabled:Bool url:string force_small_media:Bool force_large_media:Bool show_above_text:Bool = LinkPreviewOptions; + + //@class RichText //@description Describes a text object inside an instant-view web page @@ -2208,8 +2321,9 @@ pageBlockSlideshow page_blocks:vector caption:pageBlockCaption = Page //@description A link to a chat //@title Chat title //@photo Chat photo; may be null +//@accent_color_id Identifier of the accent color for chat title and background of chat photo //@username Chat username by which all other information about the chat can be resolved -pageBlockChatLink title:string photo:chatPhotoInfo username:string = PageBlock; +pageBlockChatLink title:string photo:chatPhotoInfo accent_color_id:int32 username:string = PageBlock; //@description A table //@caption Table caption @@ -2248,7 +2362,7 @@ pageBlockMap location:location zoom:int32 width:int32 height:int32 caption:pageB webPageInstantView page_blocks:vector view_count:int32 version:int32 is_rtl:Bool is_full:Bool feedback_link:InternalLinkType = WebPageInstantView; -//@description Describes a web page preview +//@description Describes a link preview //@url Original URL of the link //@display_url URL to display //@type Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else @@ -2262,6 +2376,10 @@ webPageInstantView page_blocks:vector view_count:int32 version:int32 //@embed_height Height of the embedded preview //@duration Duration of the content, in seconds //@author Author of the content +//@has_large_media True, if size of media in the preview can be changed +//@show_large_media True, if large media preview must be shown +//@skip_confirmation True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear +//@show_above_text True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text //@animation Preview of the content as an animation, if available; may be null //@audio Preview of the content as an audio file, if available; may be null //@document Preview of the content as a document, if available; may be null @@ -2272,7 +2390,7 @@ webPageInstantView page_blocks:vector view_count:int32 version:int32 //@story_sender_chat_id The identifier of the sender of the previewed story; 0 if none //@story_id The identifier of the previewed story; 0 if none //@instant_view_version Version of web page instant view (currently, can be 1 or 2); 0 if none -webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 instant_view_version:int32 = WebPage; +webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string has_large_media:Bool show_large_media:Bool skip_confirmation:Bool show_above_text:Bool animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote story_sender_chat_id:int53 story_id:int32 instant_view_version:int32 = WebPage; //@description Contains information about a country @@ -2319,12 +2437,18 @@ address country_code:string state:string city:string street_line1:string street_ //@description Contains parameters of the application theme //@background_color A color of the background in the RGB24 format //@secondary_background_color A secondary color for the background in the RGB24 format +//@header_background_color A color of the header background in the RGB24 format +//@section_background_color A color of the section background in the RGB24 format //@text_color A color of text in the RGB24 format +//@accent_text_color An accent color of the text in the RGB24 format +//@section_header_text_color A color of text on the section headers in the RGB24 format +//@subtitle_text_color A color of the subtitle text in the RGB24 format +//@destructive_text_color A color of the text for destructive actions in the RGB24 format //@hint_color A color of hints in the RGB24 format //@link_color A color of links in the RGB24 format //@button_color A color of the buttons in the RGB24 format //@button_text_color A color of text on the buttons in the RGB24 format -themeParameters background_color:int32 secondary_background_color:int32 text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; +themeParameters background_color:int32 secondary_background_color:int32 header_background_color:int32 section_background_color:int32 text_color:int32 accent_text_color:int32 section_header_text_color:int32 subtitle_text_color:int32 destructive_text_color:int32 hint_color:int32 link_color:int32 button_color:int32 button_text_color:int32 = ThemeParameters; //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @@ -2467,6 +2591,10 @@ inputInvoiceMessage chat_id:int53 message_id:int53 = InputInvoice; //@name Name of the invoice inputInvoiceName name:string = InputInvoice; +//@description An invoice for a payment toward Telegram; must not be used in the in-store apps +//@purpose Transaction purpose +inputInvoiceTelegram purpose:TelegramPaymentPurpose = InputInvoice; + //@class MessageExtendedMedia //@description Describes a media, which is attached to an invoice @@ -2494,6 +2622,15 @@ messageExtendedMediaVideo video:video caption:formattedText = MessageExtendedMed messageExtendedMediaUnsupported caption:formattedText = MessageExtendedMedia; +//@description Describes parameters of a Telegram Premium giveaway +//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription +//@additional_chat_ids Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats +//@winners_selection_date Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways +//@only_new_members True, if only new subscribers of the chats will be eligible for the giveaway +//@country_codes The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. +//-There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought on Fragment can participate in any giveaway and the country code "FT" must not be specified in the list +premiumGiveawayParameters boosted_chat_id:int53 additional_chat_ids:vector winners_selection_date:int32 only_new_members:Bool country_codes:vector = PremiumGiveawayParameters; + //@description File with the date it was uploaded //@file The file @@ -2846,8 +2983,9 @@ inputPassportElementError type:PassportElementType message:string source:InputPa //@description A text message //@text Text of the message -//@web_page A preview of the web page that's mentioned in the text; may be null -messageText text:formattedText web_page:webPage = MessageContent; +//@web_page A link preview attached to the message; may be null +//@link_preview_options Options which was used for generation of the link preview; may be null if default options were used +messageText text:formattedText web_page:webPage link_preview_options:linkPreviewOptions = MessageContent; //@description An animation message (GIF-style). //@animation The animation description @@ -3112,6 +3250,25 @@ messagePaymentSuccessfulBot currency:string total_amount:int53 is_recurring:Bool //@sticker A sticker to be shown in the message; may be null if unknown messageGiftedPremium gifter_user_id:int53 currency:string amount:int53 cryptocurrency:string cryptocurrency_amount:int64 month_count:int32 sticker:sticker = MessageContent; +//@description A Telegram Premium gift code was created for the user +//@creator_id Identifier of a chat or a user that created the gift code +//@is_from_giveaway True, if the gift code was created for a giveaway +//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen +//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@sticker A sticker to be shown in the message; may be null if unknown +//@code The gift code +messagePremiumGiftCode creator_id:MessageSender is_from_giveaway:Bool is_unclaimed:Bool month_count:int32 sticker:sticker code:string = MessageContent; + +//@description A Telegram Premium giveaway was created for the chat +messagePremiumGiveawayCreated = MessageContent; + +//@description A Telegram Premium giveaway +//@parameters Giveaway parameters +//@winner_count Number of users which will receive Telegram Premium subscription gift codes +//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@sticker A sticker to be shown in the message; may be null if unknown +messagePremiumGiveaway parameters:premiumGiveawayParameters winner_count:int32 month_count:int32 sticker:sticker = MessageContent; + //@description A contact has registered with Telegram messageContactRegistered = MessageContent; @@ -3125,14 +3282,9 @@ messageUserShared user_id:int53 button_id:int32 = MessageContent; //@button_id Identifier of the keyboard button with the request messageChatShared chat_id:int53 button_id:int32 = MessageContent; -//@description The current user has connected a website by logging in using Telegram Login Widget on it -//@domain_name Domain name of the connected website -messageWebsiteConnected domain_name:string = MessageContent; - //@description The user allowed the bot to send messages -//@web_app Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu -//@by_request True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages -messageBotWriteAccessAllowed web_app:webApp by_request:Bool = MessageContent; +//@reason The reason why the bot was allowed to write messages +messageBotWriteAccessAllowed reason:BotWriteAccessAllowReason = MessageContent; //@description Data from a Web App has been sent to a bot //@button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App @@ -3214,6 +3366,9 @@ textEntityTypePre = TextEntityType; //@language Programming language of the code; as defined by the sender textEntityTypePreCode language:string = TextEntityType; +//@description Text that must be formatted as if inside a blockquote HTML tag +textEntityTypeBlockQuote = TextEntityType; + //@description A text description shown instead of a raw URL //@url HTTP or tg:// URL to be opened when the link is clicked textEntityTypeTextUrl url:string = TextEntityType; @@ -3227,7 +3382,7 @@ textEntityTypeMentionName user_id:int53 = TextEntityType; textEntityTypeCustomEmoji custom_emoji_id:int64 = TextEntityType; //@description A media timestamp -//@media_timestamp Timestamp from which a video/audio/video note/voice note playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message +//@media_timestamp Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message textEntityTypeMediaTimestamp media_timestamp:int32 = TextEntityType; @@ -3245,7 +3400,7 @@ inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail; //@send_date Point in time (Unix timestamp) when the message will be sent. The date must be within 367 days in the future messageSchedulingStateSendAtDate send_date:int32 = MessageSchedulingState; -//@description The message will be sent when the peer will be online. Applicable to private chats only and when the exact online status of the peer is known +//@description The message will be sent when the other user is online. Applicable to private chats only and when the exact online status of the other user is known messageSchedulingStateSendWhenOnline = MessageSchedulingState; @@ -3267,9 +3422,10 @@ messageSelfDestructTypeImmediately = MessageSelfDestructType; //@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum //@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled //@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates -messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 = MessageSendOptions; +//@only_preview Pass true to get a fake message instead of actually sending them +messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 only_preview:Bool = MessageSendOptions; -//@description Options to be used when a message content is copied without reference to the original sender. Service messages and messageInvoice can't be copied +//@description Options to be used when a message content is copied without reference to the original sender. Service messages, and messages with messageInvoice or messagePremiumGiveaway content can't be copied //@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local //@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false //@new_caption New message caption; pass null to copy message without caption. Ignored if replace_caption is false @@ -3280,10 +3436,10 @@ messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText //@description The content of a message to send //@description A text message -//@text Formatted text to be sent; 1-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually -//@disable_web_page_preview True, if rich web page previews for URLs in the message text must be disabled +//@text Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually +//@link_preview_options Options to be used for generation of a link preview; pass null to use default link preview options //@clear_draft True, if a chat message draft must be deleted -inputMessageText text:formattedText disable_web_page_preview:Bool clear_draft:Bool = InputMessageContent; +inputMessageText text:formattedText link_preview_options:linkPreviewOptions clear_draft:Bool = InputMessageContent; //@description An animation message (GIF-style). //@animation Animation file to be sent @@ -3308,7 +3464,7 @@ inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration: //@description A document message (general file) //@document Document to be sent //@thumbnail Document thumbnail; pass null to skip thumbnail uploading -//@disable_content_type_detection If true, automatic file type detection will be disabled and the document will always be sent as file. Always true for files sent to secret chats +//@disable_content_type_detection True, if automatic file type detection is disabled and the document must be sent as a file. Always true for files sent to secret chats //@caption Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; @@ -3416,7 +3572,7 @@ inputMessageStory story_sender_chat_id:int53 story_id:int32 = InputMessageConten //@description A forwarded message //@from_chat_id Identifier for the chat this forwarded message came from -//@message_id Identifier of the message to forward +//@message_id Identifier of the message to forward. A message can be forwarded only if message.can_be_forwarded //@in_game_share True, if a game message is being shared from a launched game; applies only to game messages //@copy_options Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; @@ -3575,10 +3731,11 @@ emojis emojis:vector = Emojis; //@is_official True, if the sticker set is official //@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set +//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@stickers List of stickers in this set //@emojis A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object -stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType is_viewed:Bool stickers:vector emojis:vector = StickerSet; +stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; //@description Represents short information about a sticker set //@id Identifier of the sticker set @@ -3591,10 +3748,11 @@ stickerSet id:int64 title:string name:string thumbnail:thumbnail thumbnail_outli //@is_official True, if the sticker set is official //@sticker_format Format of the stickers in the set //@sticker_type Type of the stickers in the set +//@needs_repainting True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only //@is_viewed True for already viewed trending sticker sets //@size Total number of stickers in the set //@covers Up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full sticker set needs to be requested -stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType is_viewed:Bool size:int32 covers:vector = StickerSetInfo; +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail thumbnail_outline:vector is_installed:Bool is_archived:Bool is_official:Bool sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; //@description Represents a list of sticker sets //@total_count Approximate total number of sticker sets found @@ -3651,7 +3809,7 @@ storyViewers total_count:int32 total_reaction_count:int32 viewers:vector = ChatActiveStories; +//@class ChatBoostSource +//@description Describes source of a chat boost + +//@description The chat created a Telegram Premium gift code for a user +//@user_id Identifier of a user, for which the gift code was created +//@gift_code The created Telegram Premium gift code, which is known only if this is a gift code for the current user, or it has already been claimed +chatBoostSourceGiftCode user_id:int53 gift_code:string = ChatBoostSource; + +//@description The chat created a Telegram Premium giveaway +//@user_id Identifier of a user that won in the giveaway; 0 if none +//@gift_code The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise +//@giveaway_message_id Identifier of the corresponding giveaway message; can be an identifier of a deleted message +//@is_unclaimed True, if the winner for the corresponding Telegram Premium subscription wasn't chosen, because there were not enough participants +chatBoostSourceGiveaway user_id:int53 gift_code:string giveaway_message_id:int53 is_unclaimed:Bool = ChatBoostSource; + +//@description A user with Telegram Premium subscription or gifted Telegram Premium boosted the chat +//@user_id Identifier of the user +chatBoostSourcePremium user_id:int53 = ChatBoostSource; + + +//@description Describes a prepaid Telegram Premium giveaway +//@id Unique identifier of the prepaid giveaway +//@winner_count Number of users which will receive Telegram Premium subscription gift codes +//@month_count Number of month the Telegram Premium subscription will be active after code activation +//@payment_date Point in time (Unix timestamp) when the giveaway was paid +prepaidPremiumGiveaway id:int64 winner_count:int32 month_count:int32 payment_date:int32 = PrepaidPremiumGiveaway; + //@description Describes current boost status of a chat -//@is_boosted True, if the current user has already boosted the chat +//@boost_url An HTTP URL, which can be used to boost the chat +//@applied_slot_ids Identifiers of boost slots of the current user applied to the chat //@level Current boost level of the chat -//@boost_count The number of times the chat was boosted +//@gift_code_boost_count The number of boosts received by the chat from created Telegram Premium gift codes and giveaways; always 0 if the current user isn't an administrator in the chat +//@boost_count The number of boosts received by the chat //@current_level_boost_count The number of boosts added to reach the current level //@next_level_boost_count The number of boosts needed to reach the next level; 0 if the next level isn't available //@premium_member_count Approximate number of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat //@premium_member_percentage A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat -chatBoostStatus is_boosted:Bool level:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double = ChatBoostStatus; +//@prepaid_giveaways The list of prepaid giveaways available for the chat; only for chat administrators +chatBoostStatus boost_url:string applied_slot_ids:vector level:int32 gift_code_boost_count:int32 boost_count:int32 current_level_boost_count:int32 next_level_boost_count:int32 premium_member_count:int32 premium_member_percentage:double prepaid_giveaways:vector = ChatBoostStatus; -//@description Describes a boost of a chat -//@user_id Identifier of a user that boosted the chat -//@expiration_date Point in time (Unix timestamp) when the boost will automatically expire if the user will not prolongate their Telegram Premium subscription -chatBoost user_id:int53 expiration_date:int32 = ChatBoost; +//@description Describes a boost applied to a chat +//@id Unique identifier of the boost +//@count The number of identical boosts applied +//@source Source of the boost +//@start_date Point in time (Unix timestamp) when the chat was boosted +//@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 @@ -3842,6 +4033,18 @@ chatBoost user_id:int53 expiration_date:int32 = ChatBoost; //@next_offset The offset for the next request. If empty, there are no more results foundChatBoosts total_count:int32 boosts:vector next_offset:string = FoundChatBoosts; +//@description Describes a slot for chat boost +//@slot_id Unique identifier of the slot +//@currently_boosted_chat_id Identifier of the currently boosted chat; 0 if none +//@start_date Point in time (Unix timestamp) when the chat was boosted; 0 if none +//@expiration_date Point in time (Unix timestamp) when the boost will expire +//@cooldown_until_date Point in time (Unix timestamp) after which the boost can be used for another chat +chatBoostSlot slot_id:int32 currently_boosted_chat_id:int53 start_date:int32 expiration_date:int32 cooldown_until_date:int32 = ChatBoostSlot; + +//@description Contains a list of chat boost slots +//@slots List of boost slots +chatBoostSlots slots:vector = ChatBoostSlots; + //@class CallDiscardReason //@description Describes the reason why a call was discarded @@ -3917,7 +4120,7 @@ callStatePending is_created:Bool is_received:Bool = CallState; callStateExchangingKeys = CallState; //@description The call is ready to use -//@protocol Call protocols supported by the peer +//@protocol Call protocols supported by the other call participant //@servers List of available call servers //@config A JSON-encoded call config //@encryption_key Call encryption key @@ -3929,7 +4132,7 @@ callStateReady protocol:callProtocol servers:vector config:string en callStateHangingUp = CallState; //@description The call has ended successfully -//@reason The reason, why the call has ended +//@reason The reason why the call has ended //@need_rating True, if the call rating must be sent to the server //@need_debug_information True, if the call debug information must be sent to the server //@need_log True, if the call log must be sent to the server @@ -3978,7 +4181,7 @@ groupCallRecentSpeaker participant_id:MessageSender is_speaking:Bool = GroupCall //@id Group call identifier //@title Group call title //@scheduled_start_date Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 if it is already active or was ended -//@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call will start +//@enabled_start_notification True, if the group call is scheduled and the current user will receive a notification when the group call starts //@is_active True, if the call is active //@is_rtmp_stream True, if the chat is an RTMP stream instead of an ordinary video chat //@is_joined True, if the call is joined @@ -4064,7 +4267,7 @@ callProblemPixelatedVideo = CallProblem; //@description Describes a call //@id Call identifier, not persistent -//@user_id Peer user identifier +//@user_id User identifier of the other call participant //@is_outgoing True, if the call is outgoing //@is_video True, if the call is a video call //@state Call state @@ -4096,8 +4299,9 @@ phoneNumberAuthenticationSettings allow_flash_call:Bool allow_missed_call:Bool i //@description Represents a reaction applied to a message //@type Type of the reaction //@sender_id Identifier of the chat member, applied the reaction +//@is_outgoing True, if the reaction was added by the current user //@date Point in time (Unix timestamp) when the reaction was added -addedReaction type:ReactionType sender_id:MessageSender date:int32 = AddedReaction; +addedReaction type:ReactionType sender_id:MessageSender is_outgoing:Bool date:int32 = AddedReaction; //@description Represents a list of reactions added to a message //@total_count The total number of found reactions @@ -4186,7 +4390,6 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol //@supports_bot_chats True, if the bot supports opening from attachment menu in private chats with other bots //@supports_group_chats True, if the bot supports opening from attachment menu in basic group and supergroup chats //@supports_channel_chats True, if the bot supports opening from attachment menu in channel chats -//@supports_settings True, if the bot supports "settings_button_pressed" event //@request_write_access True, if the user must be asked for the permission to send messages to the bot //@is_added True, if the bot was explicitly added by the user. If the bot isn't added, then on the first bot launch toggleBotIsAddedToAttachmentMenu must be called and the bot must be added or removed //@show_in_attachment_menu True, if the bot must be shown in the attachment menu @@ -4204,13 +4407,31 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol //@macos_side_menu_icon Icon for the bot in PNG format for the official macOS app side menu; may be null //@icon_color Color to highlight selected icon of the bot if appropriate; may be null //@web_app_placeholder Default placeholder for opened Web Apps in SVG format; may be null -attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool request_write_access:Bool is_added:Bool show_in_attachment_menu:Bool show_in_side_menu:Bool show_disclaimer_in_side_menu:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file ios_side_menu_icon:file android_icon:file android_side_menu_icon:file macos_icon:file macos_side_menu_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; +attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool request_write_access:Bool is_added:Bool show_in_attachment_menu:Bool show_in_side_menu:Bool show_disclaimer_in_side_menu:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file ios_side_menu_icon:file android_icon:file android_side_menu_icon:file macos_icon:file macos_side_menu_icon:file icon_color:attachmentMenuBotColor web_app_placeholder:file = AttachmentMenuBot; //@description Information about the message sent by answerWebAppQuery //@inline_message_id Identifier of the sent inline message, if known sentWebAppMessage inline_message_id:string = SentWebAppMessage; +//@class BotWriteAccessAllowReason +//@description Describes a reason why a bot was allowed to write messages to the current user + +//@description The user connected a website by logging in using Telegram Login Widget on it +//@domain_name Domain name of the connected website +botWriteAccessAllowReasonConnectedWebsite domain_name:string = BotWriteAccessAllowReason; + +//@description The user added the bot to attachment or side menu using toggleBotIsAddedToAttachmentMenu +botWriteAccessAllowReasonAddedToAttachmentMenu = BotWriteAccessAllowReason; + +//@description The user launched a Web App using getWebAppLinkUrl +//@web_app Information about the Web App +botWriteAccessAllowReasonLaunchedWebApp web_app:webApp = BotWriteAccessAllowReason; + +//@description The user accepted bot's request to send messages with allowBotToSendMessages +botWriteAccessAllowReasonAcceptedRequest = BotWriteAccessAllowReason; + + //@description Contains an HTTP URL //@url The URL httpUrl url:string = HttpUrl; @@ -4623,6 +4844,16 @@ chatEventUsernameChanged old_username:string new_username:string = ChatEventActi //@new_usernames New list of active usernames chatEventActiveUsernamesChanged old_usernames:vector new_usernames:vector = ChatEventAction; +//@description The chat accent color was changed +//@old_accent_color_id Previous identifier of chat accent color +//@new_accent_color_id New identifier of chat accent color +chatEventAccentColorChanged old_accent_color_id:int32 new_accent_color_id:int32 = ChatEventAction; + +//@description The chat's custom emoji for reply background was changed +//@old_background_custom_emoji_id Previous identifier of the custom emoji; 0 if none +//@new_background_custom_emoji_id New identifier of the custom emoji; 0 if none +chatEventBackgroundCustomEmojiChanged old_background_custom_emoji_id:int64 new_background_custom_emoji_id:int64 = ChatEventAction; + //@description The has_protected_content setting of a channel was toggled //@has_protected_content New value of has_protected_content chatEventHasProtectedContentToggled has_protected_content:Bool = ChatEventAction; @@ -4895,6 +5126,9 @@ premiumFeatureUpgradedStories = PremiumFeature; //@description The ability to boost chats premiumFeatureChatBoost = PremiumFeature; +//@description The ability to choose accent color +premiumFeatureAccentColor = PremiumFeature; + //@class PremiumStoryFeature //@description Describes a story feature available to Premium users @@ -4969,17 +5203,50 @@ premiumState state:formattedText payment_options:vector = StorePaymentPurpose; + +//@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@parameters Giveaway parameters +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +storePaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 = StorePaymentPurpose; + + +//@class TelegramPaymentPurpose +//@description Describes a purpose of a payment toward Telegram + +//@description The user creating Telegram Premium gift codes for other users +//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@user_ids Identifiers of the users which can activate the gift codes +//@month_count Number of month the Telegram Premium subscription will be active for the users +telegramPaymentPurposePremiumGiftCodes boosted_chat_id:int53 currency:string amount:int53 user_ids:vector month_count:int32 = TelegramPaymentPurpose; + +//@description The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@parameters Giveaway parameters +//@currency ISO 4217 currency code of the payment currency +//@amount Paid amount, in the smallest units of the currency +//@winner_count Number of users which will be able to activate the gift codes +//@month_count Number of month the Telegram Premium subscription will be active for the users +telegramPaymentPurposePremiumGiveaway parameters:premiumGiveawayParameters currency:string amount:int53 winner_count:int32 month_count:int32 = TelegramPaymentPurpose; + //@class DeviceToken //@description Represents a data needed to subscribe for push notifications through registerDevice method. @@ -5145,30 +5412,6 @@ canSendStoryResultWeeklyLimitExceeded retry_after:int32 = CanSendStoryResult; canSendStoryResultMonthlyLimitExceeded retry_after:int32 = CanSendStoryResult; -//@class CanBoostChatResult -//@description Represents result of checking whether the current user can boost the specific chat - -//@description The chat can be boosted -//@currently_boosted_chat_id Identifier of the currently boosted chat from which boost will be removed; 0 if none -canBoostChatResultOk currently_boosted_chat_id:int53 = CanBoostChatResult; - -//@description The chat can't be boosted -canBoostChatResultInvalidChat = CanBoostChatResult; - -//@description The chat is already boosted by the user -canBoostChatResultAlreadyBoosted = CanBoostChatResult; - -//@description The user must subscribe to Telegram Premium to be able to boost chats -canBoostChatResultPremiumNeeded = CanBoostChatResult; - -//@description The user must have Telegram Premium subscription instead of a gifted Telegram Premium -canBoostChatResultPremiumSubscriptionNeeded = CanBoostChatResult; - -//@description The user must wait the specified time before the boost can be moved to another chat -//@retry_after Time left before the user can boost another chat -canBoostChatResultWaitNeeded retry_after:int32 = CanBoostChatResult; - - //@class CanTransferOwnershipResult //@description Represents result of checking whether the current session can be used to transfer a chat ownership to another user @@ -5317,6 +5560,16 @@ pushMessageContentPhoto photo:photo caption:string is_secret:Bool is_pinned:Bool //@is_pinned True, if the message is a pinned message with the specified content pushMessageContentPoll question:string is_regular:Bool is_pinned:Bool = PushMessageContent; +//@description A message with a Telegram Premium gift code created for the user +//@month_count Number of month the Telegram Premium subscription will be active after code activation +pushMessageContentPremiumGiftCode month_count:int32 = PushMessageContent; + +//@description A message with a Telegram Premium giveaway +//@winner_count Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message +//@month_count Number of month the Telegram Premium subscription will be active after code activation; 0 for pinned message +//@is_pinned True, if the message is a pinned message with the specified content +pushMessageContentPremiumGiveaway winner_count:int32 month_count:int32 is_pinned:Bool = PushMessageContent; + //@description A screenshot of a message in the chat has been taken pushMessageContentScreenshotTaken = PushMessageContent; @@ -5424,7 +5677,7 @@ notificationTypeNewSecretChat = NotificationType; notificationTypeNewCall call_id:int32 = NotificationType; //@description New message was received through a push notification -//@message_id The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to reply +//@message_id The message identifier. The message will not be available in the chat history, but the identifier can be used in viewMessages, or as a message to be replied in the same chat //@sender_id Identifier of the sender of the message. Corresponding user or chat may be inaccessible //@sender_name Name of the sender //@is_outgoing True, if the message is outgoing @@ -5839,7 +6092,7 @@ internalLinkTypeBotStartInGroup bot_username:string start_parameter:string admin internalLinkTypeChangePhoneNumber = InternalLinkType; //@description The link is a link to boost a Telegram chat. Call getChatBoostLinkInfo with the given URL to process the link. -//-If the chat is found, then call getChatBoostStatus and canBoostChat to get the current boost status and check whether the chat can be boosted. +//-If the chat is found, then call getChatBoostStatus and getAvailableChatBoostSlots to get the current boost status and check whether the chat can be boosted. //-If the user wants to boost the chat and the chat can be boosted, then call boostChat //@url URL to be passed to getChatBoostLinkInfo internalLinkTypeChatBoost url:string = InternalLinkType; @@ -5909,6 +6162,10 @@ internalLinkTypePhoneNumberConfirmation hash:string phone_number:string = Intern //@referrer Referrer specified in the link internalLinkTypePremiumFeatures referrer:string = InternalLinkType; +//@description The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. If the code is valid and the user wants to apply it, then call applyPremiumGiftCode +//@code The Telegram Premium gift code +internalLinkTypePremiumGiftCode code:string = InternalLinkType; + //@description The link is a link to the privacy and security section of the app settings internalLinkTypePrivacyAndSecuritySettings = InternalLinkType; @@ -5998,7 +6255,7 @@ messageLink link:string is_public:Bool = MessageLink; //@chat_id If found, identifier of the chat to which the link points, 0 otherwise //@message_thread_id If found, identifier of the message thread in which to open the message, or a forum topic to open if the message is missing //@message If found, the linked message; may be null -//@media_timestamp Timestamp from which the video/audio/video note/voice note playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview +//@media_timestamp Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview //@for_album True, if the whole media album to which the message belongs is linked messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:message media_timestamp:int32 for_album:Bool = MessageLinkInfo; @@ -6008,7 +6265,7 @@ messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:mes //@is_public True, if the link will work for non-members of the chat chatBoostLink link:string is_public:Bool = ChatBoostLink; -//@description Contains information about a link to boost a a chat +//@description Contains information about a link to boost a chat //@is_public True, if the link will work for non-members of the chat //@chat_id Identifier of the chat to which the link points; 0 if the chat isn't found chatBoostLinkInfo is_public:Bool chat_id:int53 = ChatBoostLinkInfo; @@ -6263,6 +6520,10 @@ topChatCategoryCalls = TopChatCategory; topChatCategoryForwardChats = TopChatCategory; +//@description Contains 0-based match position +//@position The position of the match +foundPosition position:int32 = FoundPosition; + //@description Contains 0-based positions of matched objects //@total_count Total number of matched objects //@positions The positions of the matched objects @@ -6489,7 +6750,7 @@ chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_ //@member_count Number of members in the chat //@mean_view_count Mean number of times the recently sent messages was viewed //@mean_share_count Mean number of times the recently sent messages was shared -//@enabled_notifications_percentage A percentage of users with enabled notifications for the chat +//@enabled_notifications_percentage A percentage of users with enabled notifications for the chat; 0-100 //@member_count_graph A graph containing number of members in the chat //@join_graph A graph containing number of members joined and left the chat //@mute_graph A graph containing number of members muted and unmuted the chat @@ -6568,8 +6829,8 @@ updateAuthorizationState authorization_state:AuthorizationState = Update; //@message The new message updateNewMessage message:message = Update; -//@description A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully or even that the send message request will be processed. -//-This update will be sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message +//@description A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully. +//-This update is sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message //@chat_id The chat identifier of the sent message //@message_id A temporary message identifier updateMessageSendAcknowledged chat_id:int53 message_id:int53 = Update; @@ -6647,14 +6908,24 @@ updateChatTitle chat_id:int53 title:string = Update; //@photo The new chat photo; may be null updateChatPhoto chat_id:int53 photo:chatPhotoInfo = Update; +//@description A chat accent color has changed +//@chat_id Chat identifier +//@accent_color_id The new chat accent color identifier +updateChatAccentColor chat_id:int53 accent_color_id:int32 = Update; + +//@description A chat's custom emoji for reply background has changed +//@chat_id Chat identifier +//@background_custom_emoji_id The new identifier of a custom emoji to be shown on the reply header background; 0 if none +updateChatBackgroundCustomEmoji chat_id:int53 background_custom_emoji_id:int64 = Update; + //@description Chat permissions was changed //@chat_id Chat identifier //@permissions The new chat permissions updateChatPermissions chat_id:int53 permissions:chatPermissions = Update; -//@description The last message of a chat was changed. If last_message is null, then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case +//@description The last message of a chat was changed //@chat_id Chat identifier -//@last_message The new last message in the chat; may be null +//@last_message The new last message in the chat; may be null if the last message became unknown. While the last message is unknown, new messages can be added to the chat without corresponding updateNewMessage update //@positions The new chat positions in the chat lists updateChatLastMessage chat_id:int53 last_message:message positions:vector = Update; @@ -6776,7 +7047,7 @@ updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Updat updateChatFolders chat_folders:vector main_chat_list_position:int32 = Update; //@description The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. -//-There is no guarantee that it will be sent just after the number of online users has changed +//-There is no guarantee that it is sent just after the number of online users has changed //@chat_id Identifier of the chat //@online_member_count New number of online members in the chat, or 0 if unknown updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update; @@ -7026,6 +7297,12 @@ updateSelectedBackground for_dark_theme:Bool background:background = Update; //@chat_themes The new list of chat themes updateChatThemes chat_themes:vector = Update; +//@description The list of supported accent colors has changed +//@colors Information about supported colors; colors with identifiers 0 (red), 1 (orange), 2 (purple/violet), 3 (green), 4 (cyan), 5 (blue), 6 (pink) must always be supported +//-and aren't included in the list. The exact colors for the accent colors with identifiers 0-6 must be taken from the app theme +//@available_accent_color_ids The list of accent color identifiers, which can be set through setAccentColor and setChatAccentColor. The colors must be shown in the specififed order +updateAccentColors colors:vector available_accent_color_ids:vector = Update; + //@description Some language pack strings have been updated //@localization_target Localization target to which the language pack belongs //@language_pack_id Identifier of the updated language pack @@ -7183,6 +7460,11 @@ updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatIn //@invite_link The invite link, which was used to send join request; may be null updateNewChatJoinRequest chat_id:int53 request:chatJoinRequest user_chat_id:int53 invite_link:chatInviteLink = Update; +//@description A chat boost has changed; for bots only +//@chat_id Chat identifier +//@boost New information about the boost +updateChatBoost chat_id:int53 boost:chatBoost = Update; + //@description Contains a list of updates //@updates List of updates @@ -7467,8 +7749,9 @@ getMessage chat_id:int53 message_id:int53 = Message; //@message_id Identifier of the message to get getMessageLocally chat_id:int53 message_id:int53 = Message; -//@description Returns information about a message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, and the topic creation message for messages -//-of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without replied message respectively +//@description Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, +//-the message with a previously set same background, and the topic creation message for messages of the types +//-messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without non-bundled replied message respectively //@chat_id Identifier of the chat the message belongs to //@message_id Identifier of the reply message getRepliedMessage chat_id:int53 message_id:int53 = Message; @@ -7723,13 +8006,6 @@ getChatMessagePosition chat_id:int53 message_id:int53 filter:SearchMessagesFilte //@chat_id Chat identifier getChatScheduledMessages chat_id:int53 = Messages; -//@description Returns forwarded copies of a channel message to different public channels. For optimal performance, the number of returned messages is chosen by TDLib -//@chat_id Chat identifier of the message -//@message_id Message identifier -//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; - //@description Returns sponsored messages to be shown in a chat; for channel chats only //@chat_id Identifier of the chat getChatSponsoredMessages chat_id:int53 = SponsoredMessages; @@ -7754,7 +8030,7 @@ removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = //@description Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels, or if message.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request //@chat_id Identifier of the chat to which the message belongs //@message_id Identifier of the message -//@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note playing must start, in seconds. The media can be in the message content or in its web page preview +//@media_timestamp If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its web page preview //@for_album Pass true to create a link for the whole media album //@in_message_thread Pass true to create a link to the message as a channel post comment, in a message thread, or a forum topic getMessageLink chat_id:int53 message_id:int53 media_timestamp:int32 for_album:Bool in_message_thread:Bool = MessageLink; @@ -7813,20 +8089,19 @@ setChatMessageSender chat_id:int53 message_sender_id:MessageSender = Ok; //@description Sends a message. Returns the sent message //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the message will be sent -//@reply_to Identifier of the replied message or story; pass null if none +//@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the message; pass null to use default options //@reply_markup Markup for replying to the message; pass null if none; for bots only //@input_message_content The content of the message to be sent -sendMessage chat_id:int53 message_thread_id:int53 reply_to:MessageReplyTo options:messageSendOptions reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; +sendMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; //@description Sends 2-10 messages grouped together into an album. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the messages will be sent -//@reply_to Identifier of the replied message or story; pass null if none +//@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the messages; pass null to use default options //@input_message_contents Contents of messages to be sent. At most 10 messages can be added to an album -//@only_preview Pass true to get fake messages instead of actually sending them -sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:MessageReplyTo options:messageSendOptions input_message_contents:vector only_preview:Bool = Messages; +sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions input_message_contents:vector = Messages; //@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message //@bot_user_id Identifier of the bot @@ -7837,37 +8112,37 @@ sendBotStartMessage bot_user_id:int53 chat_id:int53 parameter:string = Message; //@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message //@chat_id Target chat //@message_thread_id If not 0, a message thread identifier in which the message will be sent -//@reply_to Identifier of the replied message or story; pass null if none +//@reply_to Information about the message or story to be replied; pass null if none //@options Options to be used to send the message; pass null to use default options //@query_id Identifier of the inline query //@result_id Identifier of the inline query result //@hide_via_bot Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") -sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:MessageReplyTo options:messageSendOptions query_id:int64 result_id:string hide_via_bot:Bool = Message; +sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to:InputMessageReplyTo options:messageSendOptions query_id:int64 result_id:string hide_via_bot:Bool = Message; //@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message //@chat_id Identifier of the chat to which to forward messages //@message_thread_id If not 0, a message thread identifier in which the message will be sent; for forum threads only //@from_chat_id Identifier of the chat from which to forward messages -//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously +//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded //@options Options to be used to send the messages; pass null to use default options //@send_copy Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local //@remove_caption Pass true to remove media captions of message copies. Ignored if send_copy is false -//@only_preview Pass true to get fake messages instead of actually forwarding them -forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool only_preview:Bool = Messages; +forwardMessages chat_id:int53 message_thread_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; //@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. //-If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message //@chat_id Identifier of the chat to send messages //@message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order -resendMessages chat_id:int53 message_ids:vector = Messages; +//@quote New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false +resendMessages chat_id:int53 message_ids:vector quote:formattedText = Messages; //@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message //@chat_id Target chat //@sender_id Identifier of the sender of the message -//@reply_to Identifier of the replied message or story; pass null if none +//@reply_to Information about the message or story to be replied; pass null if none //@disable_notification Pass true to disable notification for the message //@input_message_content The content of the message to be added -addLocalMessage chat_id:int53 sender_id:MessageSender reply_to:MessageReplyTo disable_notification:Bool input_message_content:InputMessageContent = Message; +addLocalMessage chat_id:int53 sender_id:MessageSender reply_to:InputMessageReplyTo disable_notification:Bool input_message_content:InputMessageContent = Message; //@description Deletes messages //@chat_id Chat identifier @@ -8076,11 +8351,17 @@ getMessageAddedReactions chat_id:int53 message_id:int53 reaction_type:ReactionTy setDefaultReactionType reaction_type:ReactionType = Ok; +//@description Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously +//@text Text in which to search for the quote +//@quote Quote to search for +//@quote_position Approximate quote position in UTF-16 code units +searchQuote text:formattedText quote:formattedText quote_position:int32 = FoundPosition; + //@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) found in the text. Can be called synchronously //@text The text in which to look for entities getTextEntities text:string = TextEntities; -//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously +//@description Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously //@text The text to parse //@parse_mode Text parse mode parseTextEntities text:string parse_mode:TextParseMode = FormattedText; @@ -8239,8 +8520,8 @@ sendWebAppData bot_user_id:int53 button_text:string data:string = Ok; //@theme Preferred Web App theme; pass null to use the default theme //@application_name Short name of the application; 0-64 English letters, digits, and underscores //@message_thread_id If not 0, a message thread identifier in which the message will be sent -//@reply_to Identifier of the replied message or story for the message sent by the Web App; pass null if none -openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:MessageReplyTo = WebAppInfo; +//@reply_to Information about the message or story to be replied in the message sent by the Web App; pass null if none +openWebApp chat_id:int53 bot_user_id:int53 url:string theme:themeParameters application_name:string message_thread_id:int53 reply_to:InputMessageReplyTo = WebAppInfo; //@description Informs TDLib that a previously opened Web App was closed //@web_app_launch_id Identifier of Web App launch, received from openWebApp @@ -8539,6 +8820,12 @@ setChatTitle chat_id:int53 title:string = Ok; //@photo New chat photo; pass null to delete the chat photo setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok; +//@description Changes accent color and background custom emoji of a chat. Supported only for channels with getOption("channel_custom_accent_color_boost_level_min") boost level. Requires can_change_info administrator right +//@chat_id Chat identifier +//@accent_color_id Identifier of the accent color to use +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none +setChatAccentColor chat_id:int53 accent_color_id:int32 background_custom_emoji_id:int64 = Ok; + //@description Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels //-Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). //@chat_id Chat identifier @@ -8883,17 +9170,17 @@ reportStory story_sender_chat_id:int53 story_id:int32 reason:ReportReason text:s activateStoryStealthMode = Ok; +//@description Returns the list of available chat boost slots for the current user +getAvailableChatBoostSlots = ChatBoostSlots; + //@description Returns the current boost status for a channel chat //@chat_id Identifier of the channel chat getChatBoostStatus chat_id:int53 = ChatBoostStatus; -//@description Checks whether the current user can boost a chat -//@chat_id Identifier of the chat -canBoostChat chat_id:int53 = CanBoostChatResult; - -//@description Boosts a chat +//@description Boosts a chat and returns the list of available chat boost slots for the current user after the boost //@chat_id Identifier of the chat -boostChat chat_id:int53 = Ok; +//@slot_ids Identifiers of boost slots of the current user from which to apply boosts to the chat +boostChat chat_id:int53 slot_ids:vector = ChatBoostSlots; //@description Returns an HTTPS link to boost the specified channel chat //@chat_id Identifier of the chat @@ -8903,11 +9190,17 @@ getChatBoostLink chat_id:int53 = ChatBoostLink; //@url The link to boost a chat getChatBoostLinkInfo url:string = ChatBoostLinkInfo; -//@description Returns list of boosts applied to a chat. The user must be an administrator in the channel chat to get the list of boosts +//@description Returns list of boosts applied to a chat; requires administrator rights in the channel chat //@chat_id Identifier of the chat +//@only_gift_codes Pass true to receive only boosts received from gift codes and giveaways created by the chat //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results //@limit The maximum number of boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit -getChatBoosts chat_id:int53 offset:string limit:int32 = FoundChatBoosts; +getChatBoosts chat_id:int53 only_gift_codes:Bool offset:string limit:int32 = FoundChatBoosts; + +//@description Returns list of boosts applied to a chat by a given user; requires administrator rights in the channel chat; for bots only +//@chat_id Identifier of the chat +//@user_id Identifier of the user +getUserChatBoosts chat_id:int53 user_id:int53 = FoundChatBoosts; //@description Returns information about a bot that can be added to attachment or side menu @@ -8958,7 +9251,7 @@ cancelDownloadFile file_id:int32 only_if_pending:Bool = Ok; getSuggestedFileName file_id:int32 directory:string = Text; //@description Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used -//-to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message +//-to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it is sent in a message //@file File to upload //@file_type File type; pass null if unknown //@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which preliminaryUploadFile was called will be uploaded first @@ -9212,7 +9505,7 @@ getGroupCall group_call_id:int32 = GroupCall; //@group_call_id Group call identifier startScheduledGroupCall group_call_id:int32 = Ok; -//@description Toggles whether the current user will receive a notification when the group call will start; scheduled group calls only +//@description Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only //@group_call_id Group call identifier //@enabled_start_notification New value of the enabled_start_notification setting toggleGroupCallEnabledStartNotification group_call_id:int32 enabled_start_notification:Bool = Ok; @@ -9563,6 +9856,9 @@ getDefaultChatPhotoCustomEmojiStickers = Stickers; //@description Returns default list of custom emoji stickers for placing on a profile photo getDefaultProfilePhotoCustomEmojiStickers = Stickers; +//@description Returns default list of custom emoji stickers for reply background +getDefaultBackgroundCustomEmojiStickers = Stickers; + //@description Returns saved animations getSavedAnimations = Animations; @@ -9590,9 +9886,10 @@ searchHashtags prefix:string limit:int32 = Hashtags; removeRecentHashtag hashtag:string = Ok; -//@description Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview +//@description Returns a link preview by the text of a message. Do not call this function too often. Returns a 404 error if the text has no link preview //@text Message text with formatting -getWebPagePreview text:formattedText = WebPage; +//@link_preview_options Options to be used for generation of the link preview; pass null to use default link preview options +getWebPagePreview text:formattedText link_preview_options:linkPreviewOptions = WebPage; //@description Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page //@url The web page URL @@ -9609,6 +9906,11 @@ setProfilePhoto photo:InputChatPhoto is_public:Bool = Ok; //@profile_photo_id Identifier of the profile photo to delete deleteProfilePhoto profile_photo_id:int64 = Ok; +//@description Changes accent color and background custom emoji for the current user; for Telegram Premium users only +//@accent_color_id Identifier of the accent color to use +//@background_custom_emoji_id Identifier of a custom emoji to be shown on the reply header background; 0 if none +setAccentColor accent_color_id:int32 background_custom_emoji_id:int64 = Ok; + //@description Changes the first and last name of the current user //@first_name The new value of the first name for the current user; 1-64 characters //@last_name The new value of the optional last name for the current user; 0-64 characters @@ -10107,6 +10409,13 @@ getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; //@is_dark Pass true if a dark theme is used by the application getMessageStatistics chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; +//@description Returns forwarded copies of a channel message to different public channels. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages is chosen by TDLib +//@chat_id Chat identifier of the message +//@message_id Message identifier +//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; + //@description Loads an asynchronous or a zoomed in statistical graph //@chat_id Chat identifier //@token The token for graph loading @@ -10379,6 +10688,28 @@ clickPremiumSubscriptionButton = Ok; //@description Returns state of Telegram Premium subscription and promotion videos for Premium features getPremiumState = PremiumState; +//@description Returns available options for Telegram Premium gift code or giveaway creation +//@boosted_chat_id Identifier of the channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none +getPremiumGiftCodePaymentOptions boosted_chat_id:int53 = PremiumGiftCodePaymentOptions; + +//@description Return information about a Telegram Premium gift code +//@code The code to check +checkPremiumGiftCode code:string = PremiumGiftCodeInfo; + +//@description Applies a Telegram Premium gift code +//@code The code to apply +applyPremiumGiftCode code:string = Ok; + +//@description Launches a prepaid Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +//@giveaway_id Unique identifier of the prepaid giveaway +//@parameters Giveaway parameters +launchPrepaidPremiumGiveaway giveaway_id:int64 parameters:premiumGiveawayParameters = Ok; + +//@description Returns information about a Telegram Premium giveaway +//@chat_id Identifier of the channel chat which started the giveaway +//@message_id Identifier of the giveaway message in the chat +getPremiumGiveawayInfo chat_id:int53 message_id:int53 = PremiumGiveawayInfo; + //@description Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase //@purpose Transaction purpose canPurchasePremium purpose:StorePaymentPurpose = Ok; diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index cfa651e09ffd82..fdbfa3f20a9840 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -115,9 +115,9 @@ void ShareBotGame( const auto api = &history->session().api(); history->session().sender().request(TLsendMessage( peerToTdbChat(history->peer->id), - tl_int53(action.replyTo.topicRootId.bare), + MessageThreadId(history->peer, action), MessageReplyTo(action), - std::nullopt, // Options. + std::optional(), tl_inputMessageGame( peerToTdbChat(bot->id), tl_string(shortName)) diff --git a/Telegram/build/docker/centos_env/Dockerfile b/Telegram/build/docker/centos_env/Dockerfile index 300b7650d9de51..16be9760d73e83 100644 --- a/Telegram/build/docker/centos_env/Dockerfile +++ b/Telegram/build/docker/centos_env/Dockerfile @@ -855,7 +855,7 @@ ENV OPENSSL_ROOT_DIR {{ OPENSSL_PREFIX }} RUN git init td \ && cd td \ && git remote add origin {{ GIT }}/tdlib/td.git \ - && git fetch --depth=1 origin 9b4266c0c93c832aba718845d1c8b39f5d5282fe \ + && git fetch --depth=1 origin aefbf0327f65d23557d02e86cbd5d9abee5d1ce8 \ && git reset --hard FETCH_HEAD \ && rm -rf .git \ && env -u CFLAGS -u CXXFLAGS cmake -B out/Release . \ diff --git a/Telegram/build/prepare/prepare.py b/Telegram/build/prepare/prepare.py index d015cbaed02bdd..f6755c076f93ac 100644 --- a/Telegram/build/prepare/prepare.py +++ b/Telegram/build/prepare/prepare.py @@ -1571,7 +1571,7 @@ def runStages(): stage('td', """ git clone https://github.com/tdlib/td.git cd td - git checkout 9b4266c0c9 + git checkout aefbf0327f win: SET OPENSSL_DIR=%LIBS_DIR%\\openssl SET OPENSSL_LIBS_DIR=%OPENSSL_DIR%\\out