Add SpeakingInCall chat action.

This commit is contained in:
levlam 2020-11-23 19:50:03 +03:00
parent ccb0a4f63c
commit 905aa871e1
5 changed files with 21 additions and 1 deletions

View File

@ -1931,6 +1931,8 @@ chatActionStartPlayingGame = ChatAction;
chatActionRecordingVideoNote = ChatAction;
//@description The user is uploading a video note @progress Upload progress, as a percentage
chatActionUploadingVideoNote progress:int32 = ChatAction;
//@description The user is speaking in a call; supergroups only
chatActionSpeakingInCall = ChatAction;
//@description The user has cancelled the previous action
chatActionCancel = ChatAction;

Binary file not shown.

View File

@ -80,6 +80,9 @@ DialogAction::DialogAction(tl_object_ptr<td_api::ChatAction> &&action) {
init(Type::UploadingVideoNote, uploading_action->progress_);
break;
}
case td_api::chatActionSpeakingInCall::ID:
init(Type::SpeakingInCall);
break;
default:
UNREACHABLE();
break;
@ -137,6 +140,9 @@ DialogAction::DialogAction(tl_object_ptr<telegram_api::SendMessageAction> &&acti
init(Type::UploadingVideoNote, upload_round_action->progress_);
break;
}
case telegram_api::speakingInGroupCallAction::ID:
init(Type::SpeakingInCall);
break;
default:
UNREACHABLE();
break;
@ -171,6 +177,8 @@ tl_object_ptr<telegram_api::SendMessageAction> DialogAction::get_input_send_mess
return make_tl_object<telegram_api::sendMessageRecordRoundAction>();
case Type::UploadingVideoNote:
return make_tl_object<telegram_api::sendMessageUploadRoundAction>(progress_);
case Type::SpeakingInCall:
return make_tl_object<telegram_api::speakingInGroupCallAction>();
default:
UNREACHABLE();
return nullptr;
@ -205,6 +213,8 @@ tl_object_ptr<secret_api::SendMessageAction> DialogAction::get_secret_input_send
return make_tl_object<secret_api::sendMessageRecordRoundAction>();
case Type::UploadingVideoNote:
return make_tl_object<secret_api::sendMessageUploadRoundAction>();
case Type::SpeakingInCall:
return make_tl_object<secret_api::sendMessageTypingAction>();
default:
UNREACHABLE();
return nullptr;
@ -239,6 +249,8 @@ tl_object_ptr<td_api::ChatAction> DialogAction::get_chat_action_object() const {
return td_api::make_object<td_api::chatActionRecordingVideoNote>();
case Type::UploadingVideoNote:
return td_api::make_object<td_api::chatActionUploadingVideoNote>(progress_);
case Type::SpeakingInCall:
return td_api::make_object<td_api::chatActionSpeakingInCall>();
default:
UNREACHABLE();
return td_api::make_object<td_api::chatActionCancel>();
@ -366,6 +378,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, const DialogAction &act
return "RecordingVideoNote";
case DialogAction::Type::UploadingVideoNote:
return "UploadingVideoNote";
case DialogAction::Type::SpeakingInCall:
return "SpeakingInCall";
default:
UNREACHABLE();
return "Cancel";

View File

@ -30,7 +30,8 @@ class DialogAction {
ChoosingContact,
StartPlayingGame,
RecordingVideoNote,
UploadingVideoNote
UploadingVideoNote,
SpeakingInCall
};
Type type_ = Type::Cancel;
int32 progress_ = 0;

View File

@ -1195,6 +1195,9 @@ class CliClient final : public Actor {
if (action == "uvn" || action == "upload_video_note") {
return td_api::make_object<td_api::chatActionUploadingVideoNote>(50);
}
if (action == "sic" || action == "speaking_in_call") {
return td_api::make_object<td_api::chatActionSpeakingInCall>();
}
return td_api::make_object<td_api::chatActionTyping>();
}