Add chatActionChoosingSticker.

This commit is contained in:
levlam 2021-08-19 22:43:38 +03:00
parent 31a4a97ec1
commit d61b1d9348
4 changed files with 36 additions and 2 deletions

View File

@ -2022,28 +2022,43 @@ searchMessagesFilterPinned = SearchMessagesFilter;
//@description The user is typing a message
chatActionTyping = ChatAction;
//@description The user is recording a video
chatActionRecordingVideo = ChatAction;
//@description The user is uploading a video @progress Upload progress, as a percentage
chatActionUploadingVideo progress:int32 = ChatAction;
//@description The user is recording a voice note
chatActionRecordingVoiceNote = ChatAction;
//@description The user is uploading a voice note @progress Upload progress, as a percentage
chatActionUploadingVoiceNote progress:int32 = ChatAction;
//@description The user is uploading a photo @progress Upload progress, as a percentage
chatActionUploadingPhoto progress:int32 = ChatAction;
//@description The user is uploading a document @progress Upload progress, as a percentage
chatActionUploadingDocument progress:int32 = ChatAction;
//@description The user is picking a sticker to send
chatActionChoosingSticker = ChatAction;
//@description The user is picking a location or venue to send
chatActionChoosingLocation = ChatAction;
//@description The user is picking a contact to send
chatActionChoosingContact = ChatAction;
//@description The user has started to play a game
chatActionStartPlayingGame = ChatAction;
//@description The user is recording a video note
chatActionRecordingVideoNote = ChatAction;
//@description The user is uploading a video note @progress Upload progress, as a percentage
chatActionUploadingVideoNote progress:int32 = ChatAction;
//@description The user has canceled the previous action
chatActionCancel = ChatAction;

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::chatActionChoosingSticker::ID:
init(Type::ChoosingSticker);
break;
default:
UNREACHABLE();
break;
@ -144,6 +147,9 @@ DialogAction::DialogAction(tl_object_ptr<telegram_api::SendMessageAction> &&acti
init(Type::ImportingMessages, history_import_action->progress_);
break;
}
case telegram_api::sendMessageChooseStickerAction::ID:
init(Type::ChoosingSticker);
break;
default:
UNREACHABLE();
break;
@ -182,6 +188,8 @@ tl_object_ptr<telegram_api::SendMessageAction> DialogAction::get_input_send_mess
return make_tl_object<telegram_api::speakingInGroupCallAction>();
case Type::ImportingMessages:
return make_tl_object<telegram_api::sendMessageHistoryImportAction>(progress_);
case Type::ChoosingSticker:
return make_tl_object<telegram_api::sendMessageChooseStickerAction>();
default:
UNREACHABLE();
return nullptr;
@ -220,6 +228,8 @@ tl_object_ptr<secret_api::SendMessageAction> DialogAction::get_secret_input_send
return make_tl_object<secret_api::sendMessageTypingAction>();
case Type::ImportingMessages:
return make_tl_object<secret_api::sendMessageTypingAction>();
case Type::ChoosingSticker:
return make_tl_object<secret_api::sendMessageTypingAction>();
default:
UNREACHABLE();
return nullptr;
@ -254,6 +264,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::ChoosingSticker:
return td_api::make_object<td_api::chatActionChoosingSticker>();
case Type::ImportingMessages:
case Type::SpeakingInVoiceChat:
default:
@ -293,9 +305,10 @@ bool DialogAction::is_canceled_by_message_of_type(MessageContentType message_con
case MessageContentType::Location:
case MessageContentType::Venue:
return type_ == Type::ChoosingLocation;
case MessageContentType::Sticker:
return type_ == Type::ChoosingSticker;
case MessageContentType::Game:
case MessageContentType::Invoice:
case MessageContentType::Sticker:
case MessageContentType::Text:
case MessageContentType::Unsupported:
case MessageContentType::ChatCreate:
@ -400,6 +413,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, const DialogAction &act
return "SpeakingInVoiceChat";
case DialogAction::Type::ImportingMessages:
return "ImportingMessages";
case DialogAction::Type::ChoosingSticker:
return "ChoosingSticker";
default:
UNREACHABLE();
return "Cancel";

View File

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

View File

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