tg_cli: simplify testing of td_api::getSupergroupMembers.
GitOrigin-RevId: bd28265cc385b5daf1b5b54241b94a26e3272e84
This commit is contained in:
parent
bc736d0cc5
commit
d22ba35f88
@ -2192,12 +2192,17 @@ class CliClient final : public Actor {
|
|||||||
} else if (op == "GetChatAdministrators") {
|
} else if (op == "GetChatAdministrators") {
|
||||||
string chat_id = args;
|
string chat_id = args;
|
||||||
send_request(td_api::make_object<td_api::getChatAdministrators>(as_chat_id(chat_id)));
|
send_request(td_api::make_object<td_api::getChatAdministrators>(as_chat_id(chat_id)));
|
||||||
} else if (op == "GetSupergroupAdministrators") {
|
} else if (op == "GetSupergroupAdministrators" || op == "GetSupergroupBanned" || op == "GetSupergroupBots" ||
|
||||||
|
op == "GetSupergroupMembers" || op == "SearchSupergroupMembers" || op == "GetSupergroupRestricted") {
|
||||||
string supergroup_id;
|
string supergroup_id;
|
||||||
|
string query;
|
||||||
string offset;
|
string offset;
|
||||||
string limit;
|
string limit;
|
||||||
|
|
||||||
std::tie(supergroup_id, args) = split(args);
|
std::tie(supergroup_id, args) = split(args);
|
||||||
|
if (op == "GetSupergroupBanned" || op == "SearchSupergroupMembers" || op == "GetSupergroupRestricted") {
|
||||||
|
std::tie(query, args) = split(args);
|
||||||
|
}
|
||||||
std::tie(offset, limit) = split(args);
|
std::tie(offset, limit) = split(args);
|
||||||
if (offset.empty()) {
|
if (offset.empty()) {
|
||||||
offset = "0";
|
offset = "0";
|
||||||
@ -2205,95 +2210,22 @@ class CliClient final : public Actor {
|
|||||||
if (limit.empty()) {
|
if (limit.empty()) {
|
||||||
limit = "10";
|
limit = "10";
|
||||||
}
|
}
|
||||||
send_request(td_api::make_object<td_api::getSupergroupMembers>(
|
td_api::object_ptr<td_api::SupergroupMembersFilter> filter;
|
||||||
as_supergroup_id(supergroup_id), td_api::make_object<td_api::supergroupMembersFilterAdministrators>(),
|
if (op == "GetSupergroupAdministrators") {
|
||||||
to_integer<int32>(offset), to_integer<int32>(limit)));
|
filter = td_api::make_object<td_api::supergroupMembersFilterAdministrators>();
|
||||||
} else if (op == "GetSupergroupBanned") {
|
} else if (op == "GetSupergroupBanned") {
|
||||||
string supergroup_id;
|
filter = td_api::make_object<td_api::supergroupMembersFilterBanned>(query);
|
||||||
string query;
|
|
||||||
string offset;
|
|
||||||
string limit;
|
|
||||||
|
|
||||||
std::tie(supergroup_id, args) = split(args);
|
|
||||||
std::tie(query, args) = split(args);
|
|
||||||
std::tie(offset, limit) = split(args);
|
|
||||||
if (offset.empty()) {
|
|
||||||
offset = "0";
|
|
||||||
}
|
|
||||||
if (limit.empty()) {
|
|
||||||
limit = "10";
|
|
||||||
}
|
|
||||||
send_request(td_api::make_object<td_api::getSupergroupMembers>(
|
|
||||||
as_supergroup_id(supergroup_id), td_api::make_object<td_api::supergroupMembersFilterBanned>(query),
|
|
||||||
to_integer<int32>(offset), to_integer<int32>(limit)));
|
|
||||||
} else if (op == "GetSupergroupBots") {
|
} else if (op == "GetSupergroupBots") {
|
||||||
string supergroup_id;
|
filter = td_api::make_object<td_api::supergroupMembersFilterBots>();
|
||||||
string offset;
|
|
||||||
string limit;
|
|
||||||
|
|
||||||
std::tie(supergroup_id, args) = split(args);
|
|
||||||
std::tie(offset, limit) = split(args);
|
|
||||||
if (offset.empty()) {
|
|
||||||
offset = "0";
|
|
||||||
}
|
|
||||||
if (limit.empty()) {
|
|
||||||
limit = "10";
|
|
||||||
}
|
|
||||||
send_request(td_api::make_object<td_api::getSupergroupMembers>(
|
|
||||||
as_supergroup_id(supergroup_id), td_api::make_object<td_api::supergroupMembersFilterBots>(),
|
|
||||||
to_integer<int32>(offset), to_integer<int32>(limit)));
|
|
||||||
} else if (op == "GetSupergroupMembers") {
|
} else if (op == "GetSupergroupMembers") {
|
||||||
string supergroup_id;
|
filter = td_api::make_object<td_api::supergroupMembersFilterRecent>();
|
||||||
string offset;
|
|
||||||
string limit;
|
|
||||||
|
|
||||||
std::tie(supergroup_id, args) = split(args);
|
|
||||||
std::tie(offset, limit) = split(args);
|
|
||||||
if (offset.empty()) {
|
|
||||||
offset = "0";
|
|
||||||
}
|
|
||||||
if (limit.empty()) {
|
|
||||||
limit = "10";
|
|
||||||
}
|
|
||||||
send_request(td_api::make_object<td_api::getSupergroupMembers>(
|
|
||||||
as_supergroup_id(supergroup_id), td_api::make_object<td_api::supergroupMembersFilterRecent>(),
|
|
||||||
to_integer<int32>(offset), to_integer<int32>(limit)));
|
|
||||||
} else if (op == "SearchSupergroupMembers") {
|
} else if (op == "SearchSupergroupMembers") {
|
||||||
string supergroup_id;
|
filter = td_api::make_object<td_api::supergroupMembersFilterSearch>(query);
|
||||||
string query;
|
} else if (op == "GetSupergroupBanned") {
|
||||||
string offset;
|
filter = td_api::make_object<td_api::supergroupMembersFilterRestricted>(query);
|
||||||
string limit;
|
|
||||||
|
|
||||||
std::tie(supergroup_id, args) = split(args);
|
|
||||||
std::tie(query, args) = split(args);
|
|
||||||
std::tie(offset, limit) = split(args);
|
|
||||||
if (offset.empty()) {
|
|
||||||
offset = "0";
|
|
||||||
}
|
|
||||||
if (limit.empty()) {
|
|
||||||
limit = "10";
|
|
||||||
}
|
}
|
||||||
send_request(td_api::make_object<td_api::getSupergroupMembers>(
|
send_request(td_api::make_object<td_api::getSupergroupMembers>(
|
||||||
as_supergroup_id(supergroup_id), td_api::make_object<td_api::supergroupMembersFilterSearch>(query),
|
as_supergroup_id(supergroup_id), std::move(filter), to_integer<int32>(offset), to_integer<int32>(limit)));
|
||||||
to_integer<int32>(offset), to_integer<int32>(limit)));
|
|
||||||
} else if (op == "GetSupergroupRestricted") {
|
|
||||||
string supergroup_id;
|
|
||||||
string query;
|
|
||||||
string offset;
|
|
||||||
string limit;
|
|
||||||
|
|
||||||
std::tie(supergroup_id, args) = split(args);
|
|
||||||
std::tie(query, args) = split(args);
|
|
||||||
std::tie(offset, limit) = split(args);
|
|
||||||
if (offset.empty()) {
|
|
||||||
offset = "0";
|
|
||||||
}
|
|
||||||
if (limit.empty()) {
|
|
||||||
limit = "10";
|
|
||||||
}
|
|
||||||
send_request(td_api::make_object<td_api::getSupergroupMembers>(
|
|
||||||
as_supergroup_id(supergroup_id), td_api::make_object<td_api::supergroupMembersFilterRestricted>(query),
|
|
||||||
to_integer<int32>(offset), to_integer<int32>(limit)));
|
|
||||||
} else if (op == "gdialog" || op == "gd") {
|
} else if (op == "gdialog" || op == "gd") {
|
||||||
send_request(td_api::make_object<td_api::getChat>(as_chat_id(args)));
|
send_request(td_api::make_object<td_api::getChat>(as_chat_id(args)));
|
||||||
} else if (op == "open") {
|
} else if (op == "open") {
|
||||||
|
Loading…
Reference in New Issue
Block a user