Rename Die to Dice.

GitOrigin-RevId: 16b7b2915163103891d9813e034762fb6a8f6bff
This commit is contained in:
levlam 2020-03-30 00:34:37 +03:00
parent d5ebf00b72
commit 12a6bc9c04
7 changed files with 56 additions and 56 deletions

View File

@ -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<botCommand> = Ok;

Binary file not shown.

View File

@ -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<const MessageDie *>(content);
store(m->die_value, storer);
case MessageContentType::Dice: {
auto m = static_cast<const MessageDice *>(content);
store(m->dice_value, storer);
break;
}
default:
@ -1260,10 +1260,10 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
content = std::move(m);
break;
}
case MessageContentType::Die: {
auto m = make_unique<MessageDie>();
parse(m->die_value, parser);
is_bad = m->die_value < 0 || m->die_value > 6;
case MessageContentType::Dice: {
auto m = make_unique<MessageDice>();
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<InputMessageContent> create_input_message_content(
content = make_unique<MessageAudio>(file_id, std::move(caption));
break;
}
case td_api::inputMessageDie::ID:
content = make_unique<MessageDie>();
case td_api::inputMessageDice::ID:
content = make_unique<MessageDice>();
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<telegram_api::InputMedia> get_input_media_impl(
auto m = static_cast<const MessageContact *>(content);
return m->contact.get_input_media_contact();
}
case MessageContentType::Die:
case MessageContentType::Dice:
return make_tl_object<telegram_api::inputMediaDice>();
case MessageContentType::Document: {
auto m = static_cast<const MessageDocument *>(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<const MessageDie *>(old_content);
auto new_ = static_cast<const MessageDie *>(new_content);
if (old_->die_value != new_->die_value) {
case MessageContentType::Dice: {
auto old_ = static_cast<const MessageDice *>(old_content);
auto new_ = static_cast<const MessageDice *>(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<MessageContent> get_message_content(Td *td, FormattedText message,
case telegram_api::messageMediaDice::ID: {
auto message_dice = move_tl_object_as<telegram_api::messageMediaDice>(media);
auto m = make_unique<MessageDie>(message_dice->value_);
if (m->die_value < 0 || m->die_value > 6) {
auto m = make_unique<MessageDice>(message_dice->value_);
if (m->dice_value < 0 || m->dice_value > 6) {
break;
}
@ -3895,11 +3895,11 @@ unique_ptr<MessageContent> dup_message_content(Td *td, DialogId dialog_id, const
}
case MessageContentType::Contact:
return make_unique<MessageContact>(*static_cast<const MessageContact *>(content));
case MessageContentType::Die:
case MessageContentType::Dice:
if (type != MessageContentDupType::Forward) {
return make_unique<MessageDie>();
return make_unique<MessageDice>();
} else {
return make_unique<MessageDie>(*static_cast<const MessageDie *>(content));
return make_unique<MessageDice>(*static_cast<const MessageDice *>(content));
}
case MessageContentType::Document: {
auto result = make_unique<MessageDocument>(*static_cast<const MessageDocument *>(content));
@ -4430,9 +4430,9 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
const MessagePoll *m = static_cast<const MessagePoll *>(content);
return make_tl_object<td_api::messagePoll>(td->poll_manager_->get_poll_object(m->poll_id));
}
case MessageContentType::Die: {
const MessageDie *m = static_cast<const MessageDie *>(content);
return make_tl_object<td_api::messageDie>(m->die_value);
case MessageContentType::Dice: {
const MessageDice *m = static_cast<const MessageDice *>(content);
return make_tl_object<td_api::messageDice>(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();

View File

@ -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();

View File

@ -54,7 +54,7 @@ enum class MessageContentType : int32 {
PassportDataSent,
PassportDataReceived,
Poll,
Die
Dice
};
StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType content_type);

View File

@ -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<vector<MessageId>> 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<MessageId> 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);

View File

@ -3123,8 +3123,8 @@ class CliClient final : public Actor {
send_message(chat_id, td_api::make_object<td_api::inputMessageForwarded>(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<td_api::inputMessageDie>());
} else if (op == "sdice") {
send_message(args, td_api::make_object<td_api::inputMessageDice>());
} else if (op == "sd") {
string chat_id;
string document_path;