Add chatMembersFilterMention.
GitOrigin-RevId: d84138594d1546275e5fea46d9cef42eac69449b
This commit is contained in:
parent
3f143b013a
commit
4b62900c0d
@ -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;
|
||||
|
||||
|
Binary file not shown.
@ -13332,6 +13332,8 @@ std::pair<int32, vector<DialogParticipant>> 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:
|
||||
|
@ -815,6 +815,14 @@ DialogParticipantsFilter get_dialog_participants_filter(const tl_object_ptr<td_a
|
||||
return DialogParticipantsFilter{DialogParticipantsFilter::Type::Restricted};
|
||||
case td_api::chatMembersFilterBanned::ID:
|
||||
return DialogParticipantsFilter{DialogParticipantsFilter::Type::Banned};
|
||||
case td_api::chatMembersFilterMention::ID: {
|
||||
auto mention_filter = static_cast<const td_api::chatMembersFilterMention *>(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:
|
||||
|
@ -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) {
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29770,6 +29770,7 @@ std::pair<int32, vector<DialogParticipant>> 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<int32, vector<DialogParticipant>> MessagesManager::search_dialog_parti
|
||||
case DialogParticipantsFilter::Type::Banned:
|
||||
request_filter = td_api::make_object<td_api::supergroupMembersFilterBanned>(query);
|
||||
break;
|
||||
case DialogParticipantsFilter::Type::Mention:
|
||||
request_filter =
|
||||
td_api::make_object<td_api::supergroupMembersFilterMention>(query, filter.top_thread_message_id.get());
|
||||
break;
|
||||
case DialogParticipantsFilter::Type::Bots:
|
||||
request_filter = td_api::make_object<td_api::supergroupMembersFilterBots>();
|
||||
break;
|
||||
@ -29857,6 +29862,7 @@ std::pair<int32, vector<DialogParticipant>> 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:
|
||||
|
@ -1096,6 +1096,9 @@ class CliClient final : public Actor {
|
||||
if (filter == "m" || filter == "members") {
|
||||
return td_api::make_object<td_api::chatMembersFilterMembers>();
|
||||
}
|
||||
if (begins_with(filter, "@")) {
|
||||
return td_api::make_object<td_api::chatMembersFilterMention>(as_message_thread_id(filter.substr(1)));
|
||||
}
|
||||
if (filter == "r" || filter == "rest" || filter == "restricted") {
|
||||
return td_api::make_object<td_api::chatMembersFilterRestricted>();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user