Add messageBotWriteAccessAllowed.by_request.
This commit is contained in:
parent
0b7914bc18
commit
249da789e7
@ -2701,8 +2701,10 @@ messageChatShared chat_id:int53 button_id:int32 = MessageContent;
|
||||
//@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website
|
||||
messageWebsiteConnected domain_name:string = MessageContent;
|
||||
|
||||
//@description The user allowed the bot to send messages @web_app Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu
|
||||
messageBotWriteAccessAllowed web_app:webApp = MessageContent;
|
||||
//@description The user allowed the bot to send messages
|
||||
//@web_app Information about the Web App, which requested the access; may be null if none or the Web App was opened from the attachment menu
|
||||
//@by_request True, if user allowed the bot to send messages by an explicit call to allowBotToSendMessages
|
||||
messageBotWriteAccessAllowed web_app:webApp by_request:Bool = MessageContent;
|
||||
|
||||
//@description Data from a Web App has been sent to a bot @button_text Text of the keyboardButtonTypeWebApp button, which opened the Web App
|
||||
messageWebAppDataSent button_text:string = MessageContent;
|
||||
|
@ -412,6 +412,7 @@ bool DialogAction::is_canceled_by_message_of_type(MessageContentType message_con
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::Story:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -929,6 +929,13 @@ class MessageStory final : public MessageContent {
|
||||
}
|
||||
};
|
||||
|
||||
class MessageWriteAccessAllowedByRequest final : public MessageContent {
|
||||
public:
|
||||
MessageContentType get_type() const final {
|
||||
return MessageContentType::WriteAccessAllowedByRequest;
|
||||
}
|
||||
};
|
||||
|
||||
template <class StorerT>
|
||||
static void store(const MessageContent *content, StorerT &storer) {
|
||||
CHECK(content != nullptr);
|
||||
@ -1329,6 +1336,8 @@ static void store(const MessageContent *content, StorerT &storer) {
|
||||
store(m->story_full_id, storer);
|
||||
break;
|
||||
}
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -1872,6 +1881,9 @@ static void parse(unique_ptr<MessageContent> &content, ParserT &parser) {
|
||||
content = std::move(m);
|
||||
break;
|
||||
}
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
content = make_unique<MessageWriteAccessAllowedByRequest>();
|
||||
break;
|
||||
default:
|
||||
is_bad = true;
|
||||
}
|
||||
@ -2475,6 +2487,7 @@ bool can_have_input_media(const Td *td, const MessageContent *content, bool is_s
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return false;
|
||||
case MessageContentType::Animation:
|
||||
case MessageContentType::Audio:
|
||||
@ -2604,6 +2617,7 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td,
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -2736,6 +2750,7 @@ static tl_object_ptr<telegram_api::InputMedia> get_input_media_impl(
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -2908,6 +2923,7 @@ void delete_message_content_thumbnail(MessageContent *content, Td *td) {
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -3102,6 +3118,7 @@ Status can_send_message_content(DialogId dialog_id, const MessageContent *conten
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
UNREACHABLE();
|
||||
}
|
||||
return Status::OK();
|
||||
@ -3239,6 +3256,7 @@ static int32 get_message_content_media_index_mask(const MessageContent *content,
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return 0;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -3463,6 +3481,8 @@ vector<UserId> get_message_content_min_user_ids(const Td *td, const MessageConte
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -4166,6 +4186,8 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -4306,6 +4328,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
LOG(ERROR) << "Receive new file " << new_file_id << " in a sent message of the type " << content_type;
|
||||
break;
|
||||
default:
|
||||
@ -5328,6 +5351,7 @@ unique_ptr<MessageContent> dup_message_content(Td *td, DialogId dialog_id, const
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return nullptr;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -5530,6 +5554,9 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
||||
return td::make_unique<MessageWebViewWriteAccessAllowed>(
|
||||
WebApp(td, telegram_api::move_object_as<telegram_api::botApp>(action->app_), owner_dialog_id));
|
||||
}
|
||||
if (action->from_request_) {
|
||||
return td::make_unique<MessageWriteAccessAllowedByRequest>();
|
||||
}
|
||||
return td::make_unique<MessageUnsupported>();
|
||||
}
|
||||
case telegram_api::messageActionSecureValuesSent::ID: {
|
||||
@ -6010,7 +6037,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
||||
return make_tl_object<td_api::messageSuggestProfilePhoto>(std::move(photo));
|
||||
}
|
||||
case MessageContentType::WriteAccessAllowed:
|
||||
return make_tl_object<td_api::messageBotWriteAccessAllowed>(nullptr);
|
||||
return make_tl_object<td_api::messageBotWriteAccessAllowed>(nullptr, false);
|
||||
case MessageContentType::RequestedDialog: {
|
||||
const auto *m = static_cast<const MessageRequestedDialog *>(content);
|
||||
if (m->dialog_id.get_type() == DialogType::User) {
|
||||
@ -6032,7 +6059,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
||||
}
|
||||
case MessageContentType::WebViewWriteAccessAllowed: {
|
||||
const auto *m = static_cast<const MessageWebViewWriteAccessAllowed *>(content);
|
||||
return td_api::make_object<td_api::messageBotWriteAccessAllowed>(m->web_app.get_web_app_object(td));
|
||||
return td_api::make_object<td_api::messageBotWriteAccessAllowed>(m->web_app.get_web_app_object(td), false);
|
||||
}
|
||||
case MessageContentType::SetBackground: {
|
||||
const auto *m = static_cast<const MessageSetBackground *>(content);
|
||||
@ -6045,6 +6072,8 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
||||
td->messages_manager_->get_chat_id_object(m->story_full_id.get_dialog_id(), "messageStory"),
|
||||
m->story_full_id.get_story_id().get(), m->via_mention);
|
||||
}
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return make_tl_object<td_api::messageBotWriteAccessAllowed>(nullptr, true);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
@ -6470,6 +6499,7 @@ string get_message_content_search_text(const Td *td, const MessageContent *conte
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return string();
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -6775,6 +6805,8 @@ void add_message_content_dependencies(Dependencies &dependencies, const MessageC
|
||||
dependencies.add(content->story_full_id);
|
||||
break;
|
||||
}
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
|
@ -126,6 +126,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, MessageContentType cont
|
||||
return string_builder << "SetBackground";
|
||||
case MessageContentType::Story:
|
||||
return string_builder << "Story";
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return string_builder << "WriteAccessAllowedByRequest";
|
||||
default:
|
||||
return string_builder << "Invalid type " << static_cast<int32>(content_type);
|
||||
}
|
||||
@ -191,6 +193,7 @@ bool is_allowed_media_group_content(MessageContentType content_type) {
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::Story:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -265,6 +268,7 @@ bool is_secret_message_content(int32 ttl, MessageContentType content_type) {
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::Story:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -332,6 +336,7 @@ bool is_service_message_content(MessageContentType content_type) {
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return true;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -399,6 +404,7 @@ bool can_have_message_content_caption(MessageContentType content_type) {
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::Story:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
@ -70,7 +70,8 @@ enum class MessageContentType : int32 {
|
||||
RequestedDialog,
|
||||
WebViewWriteAccessAllowed,
|
||||
SetBackground,
|
||||
Story
|
||||
Story,
|
||||
WriteAccessAllowedByRequest
|
||||
};
|
||||
// increase MessageUnsupported::CURRENT_VERSION each time a new message content type is added
|
||||
|
||||
|
@ -26445,6 +26445,7 @@ bool MessagesManager::can_edit_message(DialogId dialog_id, const Message *m, boo
|
||||
case MessageContentType::RequestedDialog:
|
||||
case MessageContentType::WebViewWriteAccessAllowed:
|
||||
case MessageContentType::SetBackground:
|
||||
case MessageContentType::WriteAccessAllowedByRequest:
|
||||
return false;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
Loading…
Reference in New Issue
Block a user