Add leaveGroupCall method.

This commit is contained in:
levlam 2020-11-26 11:37:54 +03:00
parent e5bf347ceb
commit 5cfda1df72
6 changed files with 16 additions and 1 deletions

View File

@ -4293,6 +4293,9 @@ sendCallDebugInformation call_id:int32 debug_information:string = Ok;
//@description Creates a group call in a chat. Available only for supergroups; requires can_manage_calls rights @chat_id Chat identifier
createChatGroupCall chat_id:int53 = GroupCallId;
//@description Leaves a group call @group_call_id Group call identifier @source Caller source identifier
leaveGroupCall group_call_id:string source:int32 = Ok;
//@description Discards a group call. Requires can_manage_calls rights in the corresponding chat @group_call_id Group call identifier
discardGroupCall group_call_id:string = Ok;

Binary file not shown.

View File

@ -24,7 +24,7 @@ Result<InputGroupCallId> InputGroupCallId::from_group_call_id(const string &grou
auto r_group_call_id = to_integer_safe<int64>(splitted.first);
auto r_access_hash = to_integer_safe<int64>(splitted.second);
if (r_group_call_id.is_error() || r_access_hash.is_error()) {
return Status::Error("Invalid group call identifier specified");
return Status::Error(400, "Invalid group call identifier specified");
}
return InputGroupCallId{r_group_call_id.ok(), r_access_hash.ok()};

View File

@ -6041,6 +6041,14 @@ void Td::on_request(uint64 id, const td_api::createChatGroupCall &request) {
contacts_manager_->create_channel_group_call(DialogId(request.chat_id_), std::move(query_promise));
}
void Td::on_request(uint64 id, const td_api::leaveGroupCall &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
TRY_RESULT_PROMISE(promise, group_call_id, InputGroupCallId::from_group_call_id(request.group_call_id_));
group_call_manager_->leave_group_call(group_call_id, request.source_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::discardGroupCall &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();

View File

@ -694,6 +694,8 @@ class Td final : public NetQueryCallback {
void on_request(uint64 id, const td_api::createChatGroupCall &request);
void on_request(uint64 id, const td_api::leaveGroupCall &request);
void on_request(uint64 id, const td_api::discardGroupCall &request);
void on_request(uint64 id, const td_api::upgradeBasicGroupChatToSupergroupChat &request);

View File

@ -2836,6 +2836,8 @@ class CliClient final : public Actor {
send_request(td_api::make_object<td_api::sendCallDebugInformation>(as_call_id(args), "{}"));
} else if (op == "ccgc") {
send_request(td_api::make_object<td_api::createChatGroupCall>(as_chat_id(args)));
} else if (op == "lgc") {
send_request(td_api::make_object<td_api::leaveGroupCall>(args, 123));
} else if (op == "dgc") {
send_request(td_api::make_object<td_api::discardGroupCall>(args));
} else if (op == "gcil") {