Split API methods for chats and message threads.

This commit is contained in:
levlam 2022-10-31 20:03:28 +03:00
parent 88e2b735b4
commit 69d53080bf
4 changed files with 66 additions and 13 deletions

View File

@ -5554,11 +5554,17 @@ getExternalLinkInfo link:string = LoginUrlInfo;
getExternalLink link:string allow_write_access:Bool = HttpUrl;
//@description Marks all mentions in a chat or a forum topic as read @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which mentions are marked as read; for forum supergroups only
readAllChatMentions chat_id:int53 message_thread_id:int53 = Ok;
//@description Marks all mentions in a chat as read @chat_id Chat identifier
readAllChatMentions chat_id:int53 = Ok;
//@description Marks all reactions in a chat or a forum topic as read @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which reactions are marked as read; for forum supergroups only
readAllChatReactions chat_id:int53 message_thread_id:int53 = Ok;
//@description Marks all mentions in a forum topic as read @chat_id Chat identifier @message_thread_id Message thread identifier in which mentions are marked as read
readAllMessageThreadMentions chat_id:int53 message_thread_id:int53 = Ok;
//@description Marks all reactions in a chat or a forum topic as read @chat_id Chat identifier
readAllChatReactions chat_id:int53 = Ok;
//@description Marks all reactions in a forum topic as read @chat_id Chat identifier @message_thread_id Message thread identifier in which reactions are marked as read
readAllMessageThreadReactions chat_id:int53 message_thread_id:int53 = Ok;
//@description Returns an existing chat corresponding to a given user @user_id User identifier @force Pass true to create the chat without a network request. In this case all information about the chat except its type, title and photo can be incorrect
@ -5686,9 +5692,12 @@ pinChatMessage chat_id:int53 message_id:int53 disable_notification:Bool only_for
//@description Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel @chat_id Identifier of the chat @message_id Identifier of the removed pinned message
unpinChatMessage chat_id:int53 message_id:int53 = Ok;
//@description Removes all pinned messages from a chat or a forum topic; requires can_pin_messages rights in the group or can_edit_messages rights in the channel @chat_id Identifier of the chat
//@message_thread_id If not 0, a message thread identifier in which messages will be unpinned; for forum supergroups only
unpinAllChatMessages chat_id:int53 message_thread_id:int53 = Ok;
//@description Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel @chat_id Identifier of the chat
unpinAllChatMessages chat_id:int53 = Ok;
//@description Removes all pinned messages from a forum topic; requires can_pin_messages rights in the supergroup @chat_id Identifier of the chat
//@message_thread_id Message thread identifier in which messages will be unpinned
unpinAllMessageThreadMessages chat_id:int53 message_thread_id:int53 = Ok;
//@description Adds the current user as a new member to a chat. Private and secret chats can't be joined using this method. May return an error with a message "INVITE_REQUEST_SENT" if only a join request was created @chat_id Chat identifier

View File

@ -5336,6 +5336,15 @@ void Td::on_request(uint64 id, const td_api::deleteChatMessagesByDate &request)
void Td::on_request(uint64 id, const td_api::readAllChatMentions &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
messages_manager_->read_all_dialog_mentions(DialogId(request.chat_id_), MessageId(), std::move(promise));
}
void Td::on_request(uint64 id, const td_api::readAllMessageThreadMentions &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
if (request.message_thread_id_ == 0) {
return send_error_raw(id, 400, "Invalid message thread identifier specified");
}
messages_manager_->read_all_dialog_mentions(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
std::move(promise));
}
@ -5343,6 +5352,15 @@ void Td::on_request(uint64 id, const td_api::readAllChatMentions &request) {
void Td::on_request(uint64 id, const td_api::readAllChatReactions &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
messages_manager_->read_all_dialog_reactions(DialogId(request.chat_id_), MessageId(), std::move(promise));
}
void Td::on_request(uint64 id, const td_api::readAllMessageThreadReactions &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
if (request.message_thread_id_ == 0) {
return send_error_raw(id, 400, "Invalid message thread identifier specified");
}
messages_manager_->read_all_dialog_reactions(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
std::move(promise));
}
@ -6197,6 +6215,14 @@ void Td::on_request(uint64 id, const td_api::unpinChatMessage &request) {
void Td::on_request(uint64 id, const td_api::unpinAllChatMessages &request) {
CREATE_OK_REQUEST_PROMISE();
messages_manager_->unpin_all_dialog_messages(DialogId(request.chat_id_), MessageId(), std::move(promise));
}
void Td::on_request(uint64 id, const td_api::unpinAllMessageThreadMessages &request) {
CREATE_OK_REQUEST_PROMISE();
if (request.message_thread_id_ == 0) {
return send_error_raw(id, 400, "Invalid message thread identifier specified");
}
messages_manager_->unpin_all_dialog_messages(DialogId(request.chat_id_), MessageId(request.message_thread_id_),
std::move(promise));
}

View File

@ -692,8 +692,12 @@ class Td final : public Actor {
void on_request(uint64 id, const td_api::readAllChatMentions &request);
void on_request(uint64 id, const td_api::readAllMessageThreadMentions &request);
void on_request(uint64 id, const td_api::readAllChatReactions &request);
void on_request(uint64 id, const td_api::readAllMessageThreadReactions &request);
void on_request(uint64 id, const td_api::getChatAvailableMessageSenders &request);
void on_request(uint64 id, const td_api::setChatMessageSender &request);
@ -914,6 +918,8 @@ class Td final : public Actor {
void on_request(uint64 id, const td_api::unpinAllChatMessages &request);
void on_request(uint64 id, const td_api::unpinAllMessageThreadMessages &request);
void on_request(uint64 id, const td_api::joinChat &request);
void on_request(uint64 id, const td_api::leaveChat &request);

View File

@ -4696,10 +4696,14 @@ class CliClient final : public Actor {
get_args(args, chat_id, message_id);
send_request(td_api::make_object<td_api::unpinChatMessage>(chat_id, message_id));
} else if (op == "uacm") {
ChatId chat_id;
get_args(args, chat_id);
send_request(td_api::make_object<td_api::unpinAllChatMessages>(chat_id));
} else if (op == "uamtm") {
ChatId chat_id;
MessageThreadId message_thread_id;
get_args(args, chat_id, message_thread_id);
send_request(td_api::make_object<td_api::unpinAllChatMessages>(chat_id, message_thread_id));
send_request(td_api::make_object<td_api::unpinAllMessageThreadMessages>(chat_id, message_thread_id));
} else if (op == "grib") {
send_request(td_api::make_object<td_api::getRecentInlineBots>());
} else if (op == "spc" || op == "su") {
@ -4798,14 +4802,22 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::getExternalLink>(link, op == "gelw"));
} else if (op == "racm") {
ChatId chat_id;
MessageThreadId message_thread_id;
get_args(args, chat_id, message_thread_id);
send_request(td_api::make_object<td_api::readAllChatMentions>(chat_id, message_thread_id));
} else if (op == "racr") {
get_args(args, chat_id);
send_request(td_api::make_object<td_api::readAllChatMentions>(chat_id));
} else if (op == "ramtm") {
ChatId chat_id;
MessageThreadId message_thread_id;
get_args(args, chat_id, message_thread_id);
send_request(td_api::make_object<td_api::readAllChatReactions>(chat_id, message_thread_id));
send_request(td_api::make_object<td_api::readAllMessageThreadMentions>(chat_id, message_thread_id));
} else if (op == "racr") {
ChatId chat_id;
get_args(args, chat_id);
send_request(td_api::make_object<td_api::readAllChatReactions>(chat_id));
} else if (op == "ramtr") {
ChatId chat_id;
MessageThreadId message_thread_id;
get_args(args, chat_id, message_thread_id);
send_request(td_api::make_object<td_api::readAllMessageThreadReactions>(chat_id, message_thread_id));
} else if (op == "tre") {
send_request(td_api::make_object<td_api::testReturnError>(
args.empty() ? nullptr : td_api::make_object<td_api::error>(-1, args)));