From 12a6bc9c04a53f95e71469fe1084c09f87e9e63b Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 30 Mar 2020 00:34:37 +0300 Subject: [PATCH] Rename Die to Dice. GitOrigin-RevId: 16b7b2915163103891d9813e034762fb6a8f6bff --- td/generate/scheme/td_api.tl | 10 ++--- td/generate/scheme/td_api.tlo | Bin 168600 -> 168604 bytes td/telegram/MessageContent.cpp | 68 ++++++++++++++--------------- td/telegram/MessageContentType.cpp | 12 ++--- td/telegram/MessageContentType.h | 2 +- td/telegram/MessagesManager.cpp | 16 +++---- td/telegram/cli.cpp | 4 +- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index a3907fc1..7d34a327 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1377,8 +1377,8 @@ messageVenue venue:venue = MessageContent; //@description A message with a user contact @contact The contact description messageContact contact:contact = MessageContent; -//@description A die message. The die value is randomly generated by the server @value The die value; 0-6. If the value is 0, the die must roll infinitely -messageDie value:int32 = MessageContent; +//@description A dice message. The dice value is randomly generated by the server @value The dice value; 0-6. If the value is 0, the dice must roll infinitely +messageDice value:int32 = MessageContent; //@description A message with a game @game The game description messageGame game:game = MessageContent; @@ -1581,8 +1581,8 @@ inputMessageVenue venue:venue = InputMessageContent; //@description A message containing a user contact @contact Contact to send inputMessageContact contact:contact = InputMessageContent; -//@description A die message -inputMessageDie = InputMessageContent; +//@description A dice message +inputMessageDice = InputMessageContent; //@description A message with a game; not supported for channels or secret chats @bot_user_id User identifier of the bot that owns the game @game_short_name Short name of the game inputMessageGame bot_user_id:int32 game_short_name:string = InputMessageContent; @@ -3955,7 +3955,7 @@ resendChangePhoneNumberCode = AuthenticationCodeInfo; //@description Checks the authentication code sent to confirm a new phone number of the user @code Verification code received by SMS, phone call or flash call checkChangePhoneNumberCode code:string = Ok; -//@description Sets the list of commands supported by the bot; for bots only @commands List of the bot commands +//@description Sets the list of commands supported by the bot; for bots only @commands List of the bot's commands setCommands commands:vector = Ok; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index 7ed4940087d72b56dce89438ca8454620151dbbc..ee23eb92f36c8b121ca6d0b84f848f421d076c9b 100644 GIT binary patch delta 1802 zcmaJ?Uuaup6!&~d>rKqVos=0^=C1ZagS}%Z4D7IK#KMN8P+1=W<{?w#Hms6$69y|9 zL}Z%^({JPJLmx8eph$7qQkIG7YHeCGsTiR?3_57B4}GYZ^l#dvjk))n^xg^WeLClN ze&_$W_x9a#_TO?Q?ECCToR8m5O8eUC?CVztXOk!PmwOO9apl?zhQwpHm1Oz*UNE)( zp+1Wi{6R%68N1zO!HbCj!sB-X45Q|UuUQxa_l{b$a>_@1-;XmS$v;gJN|8Xl-9v^`ir!8>ZQZG7(70lqLO z^YpmN7e|Pj8&!7#J}pjt${M-y^CG&-W2Vh63ZJni-BUCp_*&>eu7_C}w<1;n0R8VZyn-za_z+s_yK(106&@)z09Qrxy$H1!VZ8p}bBfMNt zkfSVJK%s9*b=Sz&85s2GC8UeQY_-PRNpSJlO$i;fWeU}~Orf&NdxWyDP~X~0F9sM| zQFqF;iQf;xD@K>fs)qK?RkIBn|MN^UA6N~bX~kkPkH9E7utsH7k3iKCy(#_CkKmuk z%Xgmn$lSkf7xGu&;j?QryyBV%bGX-iC8>I1b+a;u055zfLSxXuZ)6)qbP^;U ze&pfVVi^6k4e}3cgb*3ppccbh8kaWxlxI^jHhL%sEr=vGz5hex5?x1IiK>g1yu0r& zQS$DL7&vSmr;5sZ_;i;sg~)velw+y}#gDO83~_Xe3JGuF8T0g(xlR!0USda(>Dk^R zS!mnpbn{)-gigcTI3b~YQ!Bz=i=gfFEAc|*lJM_mb>c9< z-v&W6Fwk}#mk2Vj&g=1|CgXiKt|a}0O|+b5uVYA`4XDjbiK$1bxOwLdXuLq{?$}{YBJsv!JAg?To&j!q6M)8U0p}|AoY4{LP?#-^pC> YnDN9ygk|fDucA1ou|uip4_K!8KUwb`9RL6T delta 1761 zcmaJ?UuaWj6z{o7YZ3$Aj-r7^d)+QG&_J)yhlm*{Rwx)<9{NyN84X)q3!Q|vf)9PD zAX34HvQPc`5Tp+kipDivy2Z`@%UZiAK15LFK(L*AD6C-mKWT3pbMHCny)SK^&i6aN z^E>B!=j6MQ2af&+j+nLF>baT~&P z`%S0DpJhD7dxjfKcs4dj_`oj#0aY`jeI~}>Z?&eAnox+Z{QizC@u`;>XU2TG1W(@r zFB=+b!g6fm9=q1VKeL|&%J|8PP|0Kefs-|l$B2X*LACs8P#O@2@HH&1)e zcY8X5hIhuO!^&SBg-RBk7TN7TWfq;OM^1KzqF%NtY-mklnQ9w)dY)0O?sWx`ch8KX zfG6L>7d-qw*!KZ^Q3GBMMDMr%e!qc3v}4d;@ChO!hy;|3vI`5F{`n40WQ z%gEzlH~3jP<3n;}S$1h|ZE?(9YZ!Y=F-%=nD9MUsFVZb+J9&hKR~pgva%CSS+bY$q ztac+kwkjJ++SpGQiV~S;&4d1iHFKs{t<{CO2hf#Wqn5Rq>xBl_4YFzGvgV|bmuNHp za&rB= zAt?{E8@_F-VJ_!oecM#@)V47=;N>dRU{})4J_(z5%t1@-P^JHc_2E6)L1iBMwpffi zPwP^br!}9-Q~FH4SI>918xZ+53ay|++$Df_&pYBx0#Mhz0@Px})GoFt6kaWTA8IY6 z%mb&OmiJreKKN@3?7iX%(Fy~1@E^?Q?}Lu&r9_u ziHH6z_?}n=KbQemnLu9)ULZ?}UYj7|*8|UE4#D}2{&eVPzStt9DE_*=Ao%vOFjM^r DrNDiM diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 609821e0..16c880c8 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -643,16 +643,16 @@ class MessagePoll : public MessageContent { } }; -class MessageDie : public MessageContent { +class MessageDice : public MessageContent { public: - int32 die_value = 0; + int32 dice_value = 0; - MessageDie() = default; - explicit MessageDie(int32 die_value) : die_value(die_value) { + MessageDice() = default; + explicit MessageDice(int32 dice_value) : dice_value(dice_value) { } MessageContentType get_type() const override { - return MessageContentType::Die; + return MessageContentType::Dice; } }; @@ -913,9 +913,9 @@ static void store(const MessageContent *content, StorerT &storer) { store(m->poll_id, storer); break; } - case MessageContentType::Die: { - auto m = static_cast(content); - store(m->die_value, storer); + case MessageContentType::Dice: { + auto m = static_cast(content); + store(m->dice_value, storer); break; } default: @@ -1260,10 +1260,10 @@ static void parse(unique_ptr &content, ParserT &parser) { content = std::move(m); break; } - case MessageContentType::Die: { - auto m = make_unique(); - parse(m->die_value, parser); - is_bad = m->die_value < 0 || m->die_value > 6; + case MessageContentType::Dice: { + auto m = make_unique(); + parse(m->dice_value, parser); + is_bad = m->dice_value < 0 || m->dice_value > 6; content = std::move(m); break; } @@ -1475,8 +1475,8 @@ static Result create_input_message_content( content = make_unique(file_id, std::move(caption)); break; } - case td_api::inputMessageDie::ID: - content = make_unique(); + case td_api::inputMessageDice::ID: + content = make_unique(); break; case td_api::inputMessageDocument::ID: td->documents_manager_->create_document(file_id, string(), thumbnail, std::move(file_name), std::move(mime_type), @@ -1931,7 +1931,7 @@ bool can_have_input_media(const Td *td, const MessageContent *content) { case MessageContentType::Animation: case MessageContentType::Audio: case MessageContentType::Contact: - case MessageContentType::Die: + case MessageContentType::Dice: case MessageContentType::Document: case MessageContentType::Invoice: case MessageContentType::LiveLocation: @@ -2010,7 +2010,7 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td, return td->voice_notes_manager_->get_secret_input_media(m->file_id, std::move(input_file), m->caption.text); } case MessageContentType::Call: - case MessageContentType::Die: + case MessageContentType::Dice: case MessageContentType::Game: case MessageContentType::Invoice: case MessageContentType::LiveLocation: @@ -2143,7 +2143,7 @@ static tl_object_ptr get_input_media_impl( auto m = static_cast(content); return m->contact.get_input_media_contact(); } - case MessageContentType::Die: + case MessageContentType::Dice: return make_tl_object(); case MessageContentType::Document: { auto m = static_cast(content); @@ -2300,7 +2300,7 @@ void delete_message_content_thumbnail(MessageContent *content, Td *td) { return td->video_notes_manager_->delete_video_note_thumbnail(m->file_id); } case MessageContentType::Contact: - case MessageContentType::Die: + case MessageContentType::Dice: case MessageContentType::Game: case MessageContentType::Invoice: case MessageContentType::LiveLocation: @@ -2469,7 +2469,7 @@ static int32 get_message_content_media_index_mask(const MessageContent *content, case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: case MessageContentType::Poll: - case MessageContentType::Die: + case MessageContentType::Dice: return 0; default: UNREACHABLE(); @@ -3073,10 +3073,10 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo } break; } - case MessageContentType::Die: { - auto old_ = static_cast(old_content); - auto new_ = static_cast(new_content); - if (old_->die_value != new_->die_value) { + case MessageContentType::Dice: { + auto old_ = static_cast(old_content); + auto new_ = static_cast(new_content); + if (old_->dice_value != new_->dice_value) { need_update = true; } break; @@ -3212,7 +3212,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: case MessageContentType::Poll: - case MessageContentType::Die: + case MessageContentType::Dice: LOG(ERROR) << "Receive new file " << new_file_id << " in a sent message of the type " << content_type; break; default: @@ -3706,8 +3706,8 @@ unique_ptr get_message_content(Td *td, FormattedText message, case telegram_api::messageMediaDice::ID: { auto message_dice = move_tl_object_as(media); - auto m = make_unique(message_dice->value_); - if (m->die_value < 0 || m->die_value > 6) { + auto m = make_unique(message_dice->value_); + if (m->dice_value < 0 || m->dice_value > 6) { break; } @@ -3895,11 +3895,11 @@ unique_ptr dup_message_content(Td *td, DialogId dialog_id, const } case MessageContentType::Contact: return make_unique(*static_cast(content)); - case MessageContentType::Die: + case MessageContentType::Dice: if (type != MessageContentDupType::Forward) { - return make_unique(); + return make_unique(); } else { - return make_unique(*static_cast(content)); + return make_unique(*static_cast(content)); } case MessageContentType::Document: { auto result = make_unique(*static_cast(content)); @@ -4430,9 +4430,9 @@ tl_object_ptr get_message_content_object(const MessageCo const MessagePoll *m = static_cast(content); return make_tl_object(td->poll_manager_->get_poll_object(m->poll_id)); } - case MessageContentType::Die: { - const MessageDie *m = static_cast(content); - return make_tl_object(m->die_value); + case MessageContentType::Dice: { + const MessageDice *m = static_cast(content); + return make_tl_object(m->dice_value); } default: UNREACHABLE(); @@ -4726,7 +4726,7 @@ string get_message_content_search_text(const Td *td, const MessageContent *conte case MessageContentType::WebsiteConnected: case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: - case MessageContentType::Die: + case MessageContentType::Dice: return string(); default: UNREACHABLE(); @@ -4918,7 +4918,7 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC case MessageContentType::Poll: // no need to add poll dependencies, because they are forcely loaded with the poll break; - case MessageContentType::Die: + case MessageContentType::Dice: break; default: UNREACHABLE(); diff --git a/td/telegram/MessageContentType.cpp b/td/telegram/MessageContentType.cpp index 97ce6070..a0e0808a 100644 --- a/td/telegram/MessageContentType.cpp +++ b/td/telegram/MessageContentType.cpp @@ -94,8 +94,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType cont return string_builder << "PassportDataReceived"; case MessageContentType::Poll: return string_builder << "Poll"; - case MessageContentType::Die: - return string_builder << "Die"; + case MessageContentType::Dice: + return string_builder << "Dice"; default: UNREACHABLE(); return string_builder; @@ -146,7 +146,7 @@ bool is_allowed_media_group_content(MessageContentType content_type) { case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: case MessageContentType::Poll: - case MessageContentType::Die: + case MessageContentType::Dice: return false; default: UNREACHABLE(); @@ -201,7 +201,7 @@ bool is_secret_message_content(int32 ttl, MessageContentType content_type) { case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: case MessageContentType::Poll: - case MessageContentType::Die: + case MessageContentType::Dice: return false; default: UNREACHABLE(); @@ -230,7 +230,7 @@ bool is_service_message_content(MessageContentType content_type) { case MessageContentType::ExpiredPhoto: case MessageContentType::ExpiredVideo: case MessageContentType::Poll: - case MessageContentType::Die: + case MessageContentType::Dice: return false; case MessageContentType::ChatCreate: case MessageContentType::ChatChangeTitle: @@ -305,7 +305,7 @@ bool can_have_message_content_caption(MessageContentType content_type) { case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: case MessageContentType::Poll: - case MessageContentType::Die: + case MessageContentType::Dice: return false; default: UNREACHABLE(); diff --git a/td/telegram/MessageContentType.h b/td/telegram/MessageContentType.h index cc6f0189..b62c5b13 100644 --- a/td/telegram/MessageContentType.h +++ b/td/telegram/MessageContentType.h @@ -54,7 +54,7 @@ enum class MessageContentType : int32 { PassportDataSent, PassportDataReceived, Poll, - Die + Dice }; StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index d5d6a453..3e64521d 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6046,7 +6046,7 @@ bool MessagesManager::need_cancel_user_dialog_action(int32 action_id, MessageCon case MessageContentType::PassportDataSent: case MessageContentType::PassportDataReceived: case MessageContentType::Poll: - case MessageContentType::Die: + case MessageContentType::Dice: return false; default: UNREACHABLE(); @@ -8521,7 +8521,7 @@ bool MessagesManager::can_delete_message(DialogId dialog_id, const Message *m) c } switch (dialog_id.get_type()) { case DialogType::User: - if (G()->unix_time_cached() < m->date + 86400 && m->content->get_type() == MessageContentType::Die && + if (G()->unix_time_cached() < m->date + 86400 && m->content->get_type() == MessageContentType::Dice && dialog_id != get_my_dialog_id()) { return false; } @@ -17987,7 +17987,7 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa if (content_type == MessageContentType::Poll) { return Status::Error(400, "Polls can't be sent to secret chats"); } - if (content_type == MessageContentType::Die) { + if (content_type == MessageContentType::Dice) { return Status::Error(400, "Dice can't be sent to secret chats"); } break; @@ -18012,7 +18012,7 @@ Status MessagesManager::can_send_message_content(DialogId dialog_id, const Messa return Status::Error(400, "Not enough rights to send contacts to the chat"); } break; - case MessageContentType::Die: + case MessageContentType::Dice: if (!can_send_messages) { return Status::Error(400, "Not enough rights to send dice to the chat"); } @@ -19533,7 +19533,7 @@ bool MessagesManager::can_edit_message(DialogId dialog_id, const Message *m, boo return !get_message_content_poll_is_closed(td_, m->content.get()); } case MessageContentType::Contact: - case MessageContentType::Die: + case MessageContentType::Dice: case MessageContentType::Location: case MessageContentType::Sticker: case MessageContentType::Venue: @@ -20866,7 +20866,7 @@ Result> MessagesManager::forward_messages(DialogId to_dialog_i forward_info->from_dialog_id = saved_from_dialog_id; forward_info->from_message_id = saved_from_message_id; } else { - if (from_dialog_id != DialogId(my_id) || content_type == MessageContentType::Die) { + if (from_dialog_id != DialogId(my_id) || content_type == MessageContentType::Dice) { if (forwarded_message->is_channel_post) { if (is_broadcast_channel(from_dialog_id)) { auto author_signature = forwarded_message->sender_user_id.is_valid() @@ -21261,8 +21261,8 @@ Result MessagesManager::add_local_message( if (message_content.content->get_type() == MessageContentType::Game) { return Status::Error(400, "Can't add local game message"); } - if (message_content.content->get_type() == MessageContentType::Die) { - return Status::Error(400, "Can't add local die message"); + if (message_content.content->get_type() == MessageContentType::Dice) { + return Status::Error(400, "Can't add local dice message"); } bool is_channel_post = is_broadcast_channel(dialog_id); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 37ca067c..ceff5e9c 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -3123,8 +3123,8 @@ class CliClient final : public Actor { send_message(chat_id, td_api::make_object(as_chat_id(from_chat_id), as_message_id(from_message_id), true, op == "scopy", Random::fast(0, 1) == 0)); - } else if (op == "sdie") { - send_message(args, td_api::make_object()); + } else if (op == "sdice") { + send_message(args, td_api::make_object()); } else if (op == "sd") { string chat_id; string document_path;