From 658d172256da91f87d2ab8a8a617a43217493829 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 25 Aug 2021 20:29:14 +0300 Subject: [PATCH] Improve method name. --- td/generate/scheme/td_api.tl | 6 +++--- td/telegram/SponsoredMessages.cpp | 4 ++-- td/telegram/SponsoredMessages.h | 4 ++-- td/telegram/Td.cpp | 4 ++-- td/telegram/Td.h | 2 +- td/telegram/cli.cpp | 3 +-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index ad9da2fb0..aaf063a9d 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4052,9 +4052,6 @@ getCallbackQueryMessage chat_id:int53 message_id:int53 callback_query_id:int64 = //@description Returns information about messages. If a message is not found, returns null on the corresponding position of the result @chat_id Identifier of the chat the messages belong to @message_ids Identifiers of the messages to get getMessages chat_id:int53 message_ids:vector = Messages; -//@description Returns sponsored messages to be shown in a chat; for channel chats only @chat_id Identifier of the chat -getSponsoredMessages chat_id:int53 = SponsoredMessages; - //@description Returns information about a message thread. Can be used only if message.can_get_message_thread == true @chat_id Chat identifier @message_id Identifier of the message getMessageThread chat_id:int53 message_id:int53 = MessageThreadInfo; @@ -4212,6 +4209,9 @@ getChatScheduledMessages chat_id:int53 = Messages; //@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; + //@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification removeNotification notification_group_id:int32 notification_id:int32 = Ok; diff --git a/td/telegram/SponsoredMessages.cpp b/td/telegram/SponsoredMessages.cpp index 60433fee9..a934a5bde 100644 --- a/td/telegram/SponsoredMessages.cpp +++ b/td/telegram/SponsoredMessages.cpp @@ -75,8 +75,8 @@ class GetSponsoredMessagesQuery final : public Td::ResultHandler { } }; -void get_sponsored_messages(Td *td, DialogId dialog_id, - Promise> &&promise) { +void get_dialog_sponsored_messages(Td *td, DialogId dialog_id, + Promise> &&promise) { if (!td->messages_manager_->have_dialog_force(dialog_id, "get_sponsored_messages")) { return promise.set_error(Status::Error(400, "Chat not found")); } diff --git a/td/telegram/SponsoredMessages.h b/td/telegram/SponsoredMessages.h index 64c9adfff..5566285f1 100644 --- a/td/telegram/SponsoredMessages.h +++ b/td/telegram/SponsoredMessages.h @@ -17,7 +17,7 @@ namespace td { class Td; -void get_sponsored_messages(Td *td, DialogId dialog_id, - Promise> &&promise); +void get_dialog_sponsored_messages(Td *td, DialogId dialog_id, + Promise> &&promise); } // namespace td diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index acb00f149..f31706ba2 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -5066,10 +5066,10 @@ void Td::on_request(uint64 id, const td_api::getMessages &request) { CREATE_REQUEST(GetMessagesRequest, request.chat_id_, request.message_ids_); } -void Td::on_request(uint64 id, const td_api::getSponsoredMessages &request) { +void Td::on_request(uint64 id, const td_api::getChatSponsoredMessages &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); - get_sponsored_messages(this, DialogId(request.chat_id_), std::move(promise)); + get_dialog_sponsored_messages(this, DialogId(request.chat_id_), std::move(promise)); } void Td::on_request(uint64 id, const td_api::getMessageThread &request) { diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 5cc22a799..3d30ca80c 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -512,7 +512,7 @@ class Td final : public NetQueryCallback { void on_request(uint64 id, const td_api::getMessages &request); - void on_request(uint64 id, const td_api::getSponsoredMessages &request); + void on_request(uint64 id, const td_api::getChatSponsoredMessages &request); void on_request(uint64 id, const td_api::getMessageLink &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index bd03170ad..9404ef1c2 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2587,8 +2587,7 @@ class CliClient final : public Actor { get_args(args, chat_id, message_ids); send_request(td_api::make_object(as_chat_id(chat_id), as_message_ids(message_ids))); } else if (op == "gsm") { - string chat_id = args; - send_request(td_api::make_object(as_chat_id(chat_id))); + send_request(td_api::make_object(as_chat_id(args))); } else if (op == "gmlink") { string chat_id; string message_id;