Add chatActionImportingMessages.

This commit is contained in:
levlam 2021-01-21 01:50:21 +03:00
parent 1d5de77b1f
commit b54554c79e
5 changed files with 23 additions and 1 deletions

View File

@ -1963,6 +1963,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 importing message history. This action is sent automatically and can't be explicitly sent @progress Import progress, as a percentage
chatActionImportingMessages progress:int32 = ChatAction;
//@description The user has cancelled the previous action
chatActionCancel = ChatAction;

Binary file not shown.

View File

@ -79,6 +79,9 @@ DialogAction::DialogAction(tl_object_ptr<td_api::ChatAction> &&action) {
init(Type::UploadingVideoNote, uploading_action->progress_);
break;
}
case td_api::chatActionImportingMessages::ID:
init(Type::Cancel); // it can't be sent explicitly
break;
default:
UNREACHABLE();
break;
@ -139,6 +142,11 @@ DialogAction::DialogAction(tl_object_ptr<telegram_api::SendMessageAction> &&acti
case telegram_api::speakingInGroupCallAction::ID:
init(Type::SpeakingInVoiceChat);
break;
case telegram_api::sendMessageHistoryImportAction::ID: {
auto history_import_action = move_tl_object_as<telegram_api::sendMessageHistoryImportAction>(action);
init(Type::ImportingMessages, history_import_action->progress_);
break;
}
default:
UNREACHABLE();
break;
@ -175,6 +183,8 @@ tl_object_ptr<telegram_api::SendMessageAction> DialogAction::get_input_send_mess
return make_tl_object<telegram_api::sendMessageUploadRoundAction>(progress_);
case Type::SpeakingInVoiceChat:
return make_tl_object<telegram_api::speakingInGroupCallAction>();
case Type::ImportingMessages:
return make_tl_object<telegram_api::sendMessageHistoryImportAction>(progress_);
default:
UNREACHABLE();
return nullptr;
@ -211,6 +221,8 @@ tl_object_ptr<secret_api::SendMessageAction> DialogAction::get_secret_input_send
return make_tl_object<secret_api::sendMessageUploadRoundAction>();
case Type::SpeakingInVoiceChat:
return make_tl_object<secret_api::sendMessageTypingAction>();
case Type::ImportingMessages:
return make_tl_object<secret_api::sendMessageTypingAction>();
default:
UNREACHABLE();
return nullptr;
@ -245,6 +257,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::ImportingMessages:
return td_api::make_object<td_api::chatActionImportingMessages>(progress_);
case Type::SpeakingInVoiceChat:
default:
UNREACHABLE();
@ -381,6 +395,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, const DialogAction &act
return "UploadingVideoNote";
case DialogAction::Type::SpeakingInVoiceChat:
return "SpeakingInVoiceChat";
case DialogAction::Type::ImportingMessages:
return "ImportingMessages";
default:
UNREACHABLE();
return "Cancel";

View File

@ -31,7 +31,8 @@ class DialogAction {
StartPlayingGame,
RecordingVideoNote,
UploadingVideoNote,
SpeakingInVoiceChat
SpeakingInVoiceChat,
ImportingMessages
};
Type type_ = Type::Cancel;
int32 progress_ = 0;

View File

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