tg_cli: add class GroupCallId.

This commit is contained in:
levlam 2022-04-22 14:50:52 +03:00
parent 849125265c
commit 1f4890c906

View File

@ -684,8 +684,16 @@ class CliClient final : public Actor {
arg.call_id = to_integer<int32>(trim(args)); arg.call_id = to_integer<int32>(trim(args));
} }
static int32 as_group_call_id(string str) { struct GroupCallId {
return to_integer<int32>(trim(std::move(str))); int32 group_call_id = 0;
operator int32() const {
return group_call_id;
}
};
void get_args(string &args, GroupCallId &arg) const {
arg.group_call_id = to_integer<int32>(trim(args));
} }
static int32 as_proxy_id(string str) { static int32 as_proxy_id(string str) {
@ -3057,24 +3065,30 @@ class CliClient final : public Actor {
get_args(args, chat_id); get_args(args, chat_id);
send_request(td_api::make_object<td_api::replaceVideoChatRtmpUrl>(chat_id)); send_request(td_api::make_object<td_api::replaceVideoChatRtmpUrl>(chat_id));
} else if (op == "ggc") { } else if (op == "ggc") {
send_request(td_api::make_object<td_api::getGroupCall>(as_group_call_id(args))); GroupCallId group_call_id;
} else if (op == "ggcs") {
string group_call_id;
get_args(args, group_call_id); get_args(args, group_call_id);
send_request(td_api::make_object<td_api::getGroupCallStreams>(as_group_call_id(group_call_id))); send_request(td_api::make_object<td_api::getGroupCall>(group_call_id));
} else if (op == "ggcs") {
GroupCallId group_call_id;
get_args(args, group_call_id);
send_request(td_api::make_object<td_api::getGroupCallStreams>(group_call_id));
} else if (op == "ggcss") { } else if (op == "ggcss") {
string group_call_id; GroupCallId group_call_id;
int32 channel_id; int32 channel_id;
get_args(args, group_call_id, channel_id); get_args(args, group_call_id, channel_id);
send_request(td_api::make_object<td_api::getGroupCallStreamSegment>( send_request(td_api::make_object<td_api::getGroupCallStreamSegment>(
as_group_call_id(group_call_id), (std::time(nullptr) - 5) * 1000, 0, channel_id, nullptr)); group_call_id, (std::time(nullptr) - 5) * 1000, 0, channel_id, nullptr));
} else if (op == "ssgc") { } else if (op == "ssgc") {
send_request(td_api::make_object<td_api::startScheduledGroupCall>(as_group_call_id(args))); GroupCallId group_call_id;
get_args(args, group_call_id);
send_request(td_api::make_object<td_api::startScheduledGroupCall>(group_call_id));
} else if (op == "tgcesn" || op == "tgcesne") { } else if (op == "tgcesn" || op == "tgcesne") {
send_request(td_api::make_object<td_api::toggleGroupCallEnabledStartNotification>(as_group_call_id(args), GroupCallId group_call_id;
op == "tgcesne")); get_args(args, group_call_id);
send_request(
td_api::make_object<td_api::toggleGroupCallEnabledStartNotification>(group_call_id, op == "tgcesne"));
} else if (op == "jgc" || op == "jgcv" || op == "sgcss") { } else if (op == "jgc" || op == "jgcv" || op == "sgcss") {
string group_call_id; GroupCallId group_call_id;
string participant_id; string participant_id;
string invite_hash; string invite_hash;
get_args(args, group_call_id, participant_id, invite_hash); get_args(args, group_call_id, participant_id, invite_hash);
@ -3100,106 +3114,108 @@ class CliClient final : public Actor {
sim_sources + ",\"semantics\":\"SIM\"},{\"sources\":" + fid_sources + ",\"semantics\":\"FID\"}]}"; sim_sources + ",\"semantics\":\"SIM\"},{\"sources\":" + fid_sources + ",\"semantics\":\"FID\"}]}";
} }
if (op == "sgcss") { if (op == "sgcss") {
send_request(td_api::make_object<td_api::startGroupCallScreenSharing>( send_request(td_api::make_object<td_api::startGroupCallScreenSharing>(group_call_id, group_call_source_ + 1,
as_group_call_id(group_call_id), group_call_source_ + 1, std::move(payload))); std::move(payload)));
} else { } else {
send_request(td_api::make_object<td_api::joinGroupCall>(as_group_call_id(group_call_id), send_request(td_api::make_object<td_api::joinGroupCall>(group_call_id, as_message_sender(participant_id),
as_message_sender(participant_id), group_call_source_, group_call_source_, std::move(payload), true, true,
std::move(payload), true, true, invite_hash)); invite_hash));
} }
} else if (op == "tgcssip") { } else if (op == "tgcssip") {
string group_call_id; GroupCallId group_call_id;
bool is_paused; bool is_paused;
get_args(args, group_call_id, is_paused); get_args(args, group_call_id, is_paused);
send_request(td_api::make_object<td_api::toggleGroupCallScreenSharingIsPaused>(as_group_call_id(group_call_id), send_request(td_api::make_object<td_api::toggleGroupCallScreenSharingIsPaused>(group_call_id, is_paused));
is_paused));
} else if (op == "egcss") { } else if (op == "egcss") {
const string &group_call_id = args; GroupCallId group_call_id;
send_request(td_api::make_object<td_api::endGroupCallScreenSharing>(as_group_call_id(group_call_id))); get_args(args, group_call_id);
send_request(td_api::make_object<td_api::endGroupCallScreenSharing>(group_call_id));
} else if (op == "sgct") { } else if (op == "sgct") {
string group_call_id; GroupCallId group_call_id;
string title; string title;
get_args(args, group_call_id, title); get_args(args, group_call_id, title);
send_request(td_api::make_object<td_api::setGroupCallTitle>(as_group_call_id(group_call_id), title)); send_request(td_api::make_object<td_api::setGroupCallTitle>(group_call_id, title));
} else if (op == "tgcmnp" || op == "tgcmnpe") { } else if (op == "tgcmnp" || op == "tgcmnpe") {
send_request( GroupCallId group_call_id;
td_api::make_object<td_api::toggleGroupCallMuteNewParticipants>(as_group_call_id(args), op == "tgcmnpe")); get_args(args, group_call_id);
send_request(td_api::make_object<td_api::toggleGroupCallMuteNewParticipants>(group_call_id, op == "tgcmnpe"));
} else if (op == "rgcil") { } else if (op == "rgcil") {
send_request(td_api::make_object<td_api::revokeGroupCallInviteLink>(as_group_call_id(args))); GroupCallId group_call_id;
get_args(args, group_call_id);
send_request(td_api::make_object<td_api::revokeGroupCallInviteLink>(group_call_id));
} else if (op == "tgcimvp") { } else if (op == "tgcimvp") {
string group_call_id; GroupCallId group_call_id;
bool is_my_video_paused; bool is_my_video_paused;
get_args(args, group_call_id, is_my_video_paused); get_args(args, group_call_id, is_my_video_paused);
send_request(td_api::make_object<td_api::toggleGroupCallIsMyVideoPaused>(as_group_call_id(group_call_id), send_request(td_api::make_object<td_api::toggleGroupCallIsMyVideoPaused>(group_call_id, is_my_video_paused));
is_my_video_paused));
} else if (op == "tgcimve") { } else if (op == "tgcimve") {
string group_call_id; GroupCallId group_call_id;
bool is_my_video_enabled; bool is_my_video_enabled;
get_args(args, group_call_id, is_my_video_enabled); get_args(args, group_call_id, is_my_video_enabled);
send_request(td_api::make_object<td_api::toggleGroupCallIsMyVideoEnabled>(as_group_call_id(group_call_id), send_request(td_api::make_object<td_api::toggleGroupCallIsMyVideoEnabled>(group_call_id, is_my_video_enabled));
is_my_video_enabled));
} else if (op == "sgcpis") { } else if (op == "sgcpis") {
string group_call_id; GroupCallId group_call_id;
int32 source_id; int32 source_id;
bool is_speaking; bool is_speaking;
get_args(args, group_call_id, source_id, is_speaking); get_args(args, group_call_id, source_id, is_speaking);
send_request(td_api::make_object<td_api::setGroupCallParticipantIsSpeaking>(as_group_call_id(group_call_id), send_request(
source_id, is_speaking)); td_api::make_object<td_api::setGroupCallParticipantIsSpeaking>(group_call_id, source_id, is_speaking));
} else if (op == "igcp") { } else if (op == "igcp") {
string group_call_id; GroupCallId group_call_id;
string user_ids; string user_ids;
get_args(args, group_call_id, user_ids); get_args(args, group_call_id, user_ids);
send_request(td_api::make_object<td_api::inviteGroupCallParticipants>(as_group_call_id(group_call_id), send_request(td_api::make_object<td_api::inviteGroupCallParticipants>(group_call_id, as_user_ids(user_ids)));
as_user_ids(user_ids)));
} else if (op == "ggcil") { } else if (op == "ggcil") {
string group_call_id; GroupCallId group_call_id;
bool can_self_unmute; bool can_self_unmute;
get_args(args, group_call_id, can_self_unmute); get_args(args, group_call_id, can_self_unmute);
send_request( send_request(td_api::make_object<td_api::getGroupCallInviteLink>(group_call_id, can_self_unmute));
td_api::make_object<td_api::getGroupCallInviteLink>(as_group_call_id(group_call_id), can_self_unmute));
} else if (op == "sgcr") { } else if (op == "sgcr") {
string group_call_id; GroupCallId group_call_id;
string title; string title;
bool record_video; bool record_video;
bool use_portrait_orientation; bool use_portrait_orientation;
get_args(args, group_call_id, title, record_video, use_portrait_orientation); get_args(args, group_call_id, title, record_video, use_portrait_orientation);
send_request(td_api::make_object<td_api::startGroupCallRecording>(as_group_call_id(group_call_id), title, send_request(td_api::make_object<td_api::startGroupCallRecording>(group_call_id, title, record_video,
record_video, use_portrait_orientation)); use_portrait_orientation));
} else if (op == "egcr") { } else if (op == "egcr") {
string group_call_id; GroupCallId group_call_id;
get_args(args, group_call_id); get_args(args, group_call_id);
send_request(td_api::make_object<td_api::endGroupCallRecording>(as_group_call_id(group_call_id))); send_request(td_api::make_object<td_api::endGroupCallRecording>(group_call_id));
} else if (op == "tgcpim") { } else if (op == "tgcpim") {
string group_call_id; GroupCallId group_call_id;
string participant_id; string participant_id;
bool is_muted; bool is_muted;
get_args(args, group_call_id, participant_id, is_muted); get_args(args, group_call_id, participant_id, is_muted);
send_request(td_api::make_object<td_api::toggleGroupCallParticipantIsMuted>( send_request(td_api::make_object<td_api::toggleGroupCallParticipantIsMuted>(
as_group_call_id(group_call_id), as_message_sender(participant_id), is_muted)); group_call_id, as_message_sender(participant_id), is_muted));
} else if (op == "sgcpvl") { } else if (op == "sgcpvl") {
string group_call_id; GroupCallId group_call_id;
string participant_id; string participant_id;
int32 volume_level; int32 volume_level;
get_args(args, group_call_id, participant_id, volume_level); get_args(args, group_call_id, participant_id, volume_level);
send_request(td_api::make_object<td_api::setGroupCallParticipantVolumeLevel>( send_request(td_api::make_object<td_api::setGroupCallParticipantVolumeLevel>(
as_group_call_id(group_call_id), as_message_sender(participant_id), volume_level)); group_call_id, as_message_sender(participant_id), volume_level));
} else if (op == "tgcpihr") { } else if (op == "tgcpihr") {
string group_call_id; GroupCallId group_call_id;
string participant_id; string participant_id;
bool is_hand_raised; bool is_hand_raised;
get_args(args, group_call_id, participant_id, is_hand_raised); get_args(args, group_call_id, participant_id, is_hand_raised);
send_request(td_api::make_object<td_api::toggleGroupCallParticipantIsHandRaised>( send_request(td_api::make_object<td_api::toggleGroupCallParticipantIsHandRaised>(
as_group_call_id(group_call_id), as_message_sender(participant_id), is_hand_raised)); group_call_id, as_message_sender(participant_id), is_hand_raised));
} else if (op == "lgcp") { } else if (op == "lgcp") {
string group_call_id; GroupCallId group_call_id;
string limit; string limit;
get_args(args, group_call_id, limit); get_args(args, group_call_id, limit);
send_request( send_request(td_api::make_object<td_api::loadGroupCallParticipants>(group_call_id, as_limit(limit)));
td_api::make_object<td_api::loadGroupCallParticipants>(as_group_call_id(group_call_id), as_limit(limit)));
} else if (op == "lgc") { } else if (op == "lgc") {
send_request(td_api::make_object<td_api::leaveGroupCall>(as_group_call_id(args))); GroupCallId group_call_id;
get_args(args, group_call_id);
send_request(td_api::make_object<td_api::leaveGroupCall>(group_call_id));
} else if (op == "egc") { } else if (op == "egc") {
send_request(td_api::make_object<td_api::endGroupCall>(as_group_call_id(args))); GroupCallId group_call_id;
get_args(args, group_call_id);
send_request(td_api::make_object<td_api::endGroupCall>(group_call_id));
} else if (op == "rpcil") { } else if (op == "rpcil") {
ChatId chat_id; ChatId chat_id;
get_args(args, chat_id); get_args(args, chat_id);