diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 3d428f2af..f6de33fbe 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -500,6 +500,9 @@ chatMembersFilterAdministrators = ChatMembersFilter; //@description Returns all chat members, including restricted chat members chatMembersFilterMembers = ChatMembersFilter; +//@description Returns users which can be mentioned in the chat @message_thread_id If non-zero, the identifier of the current message thread +chatMembersFilterMention message_thread_id:int53 = ChatMembersFilter; + //@description Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup chatMembersFilterRestricted = ChatMembersFilter; @@ -524,15 +527,15 @@ supergroupMembersFilterAdministrators = SupergroupMembersFilter; //@description Used to search for supergroup or channel members via a (string) query @query Query to search for supergroupMembersFilterSearch query:string = SupergroupMembersFilter; -//@description Returns users which can be mentioned in the supergroup @query Query to search for @message_thread_id If non-zero, the identifier of the current message thread -supergroupMembersFilterMention query:string message_thread_id:int53 = SupergroupMembersFilter; - //@description Returns restricted supergroup members; can be used only by administrators @query Query to search for supergroupMembersFilterRestricted query:string = SupergroupMembersFilter; //@description Returns users banned from the supergroup or channel; can be used only by administrators @query Query to search for supergroupMembersFilterBanned query:string = SupergroupMembersFilter; +//@description Returns users which can be mentioned in the supergroup @query Query to search for @message_thread_id If non-zero, the identifier of the current message thread +supergroupMembersFilterMention query:string message_thread_id:int53 = SupergroupMembersFilter; + //@description Returns bot members of the supergroup or channel supergroupMembersFilterBots = SupergroupMembersFilter; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index e7e250609..ad1905961 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 5cb5ab848..d00ac2435 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -13332,6 +13332,8 @@ std::pair> ContactsManager::search_chat_partici return participant.status.is_restricted(); // should be always false case DialogParticipantsFilter::Type::Banned: return participant.status.is_banned(); // should be always false + case DialogParticipantsFilter::Type::Mention: + return true; case DialogParticipantsFilter::Type::Bots: return is_user_bot(participant.user_id); default: diff --git a/td/telegram/DialogParticipant.cpp b/td/telegram/DialogParticipant.cpp index adfd9e9fe..5907fca2b 100644 --- a/td/telegram/DialogParticipant.cpp +++ b/td/telegram/DialogParticipant.cpp @@ -815,6 +815,14 @@ DialogParticipantsFilter get_dialog_participants_filter(const tl_object_ptr(filter.get()); + auto top_thread_message_id = MessageId(mention_filter->message_thread_id_); + if (!top_thread_message_id.is_valid() || !top_thread_message_id.is_server()) { + top_thread_message_id = MessageId(); + } + return DialogParticipantsFilter{DialogParticipantsFilter::Type::Mention, top_thread_message_id}; + } case td_api::chatMembersFilterBots::ID: return DialogParticipantsFilter{DialogParticipantsFilter::Type::Bots}; default: diff --git a/td/telegram/DialogParticipant.h b/td/telegram/DialogParticipant.h index 826872c19..9681d5fff 100644 --- a/td/telegram/DialogParticipant.h +++ b/td/telegram/DialogParticipant.h @@ -445,10 +445,12 @@ StringBuilder &operator<<(StringBuilder &string_builder, const ChannelParticipan class DialogParticipantsFilter { public: - enum class Type : int32 { Contacts, Administrators, Members, Restricted, Banned, Bots }; + enum class Type : int32 { Contacts, Administrators, Members, Restricted, Banned, Mention, Bots }; Type type; + MessageId top_thread_message_id; - explicit DialogParticipantsFilter(Type type) : type(type) { + explicit DialogParticipantsFilter(Type type, MessageId top_thread_message_id = MessageId()) + : type(type), top_thread_message_id(top_thread_message_id) { } }; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 78e2f5996..16ab91cb7 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -29770,6 +29770,7 @@ std::pair> MessagesManager::search_private_chat case DialogParticipantsFilter::Type::Administrators: break; case DialogParticipantsFilter::Type::Members: + case DialogParticipantsFilter::Type::Mention: user_ids.push_back(my_user_id); if (peer_user_id.is_valid() && peer_user_id != my_user_id) { user_ids.push_back(peer_user_id); @@ -29840,6 +29841,10 @@ std::pair> MessagesManager::search_dialog_parti case DialogParticipantsFilter::Type::Banned: request_filter = td_api::make_object(query); break; + case DialogParticipantsFilter::Type::Mention: + request_filter = + td_api::make_object(query, filter.top_thread_message_id.get()); + break; case DialogParticipantsFilter::Type::Bots: request_filter = td_api::make_object(); break; @@ -29857,6 +29862,7 @@ std::pair> MessagesManager::search_dialog_parti case DialogParticipantsFilter::Type::Members: case DialogParticipantsFilter::Type::Restricted: case DialogParticipantsFilter::Type::Banned: + case DialogParticipantsFilter::Type::Mention: // query is passed to the server request break; default: diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 4991e6b19..f6c3cdd69 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -1096,6 +1096,9 @@ class CliClient final : public Actor { if (filter == "m" || filter == "members") { return td_api::make_object(); } + if (begins_with(filter, "@")) { + return td_api::make_object(as_message_thread_id(filter.substr(1))); + } if (filter == "r" || filter == "rest" || filter == "restricted") { return td_api::make_object(); }