Add attachMenuBot.supports_settings.

This commit is contained in:
levlam 2022-05-31 17:57:57 +03:00
parent 6d0e57a8c5
commit f189351397
3 changed files with 12 additions and 5 deletions

View File

@ -2556,6 +2556,7 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol
//@supports_bot_chats True, if the bot supports opening from attachment menu in private chats with other bots
//@supports_group_chats True, if the bot supports opening from attachment menu in basic group and supergroup chats
//@supports_channel_chats True, if the bot supports opening from attachment menu in channel chats
//@supports_settings True, if the bot supports "settings_button_pressed" event
//@name Name for the bot in attachment menu
//@name_color Color to highlight selected name of the bot if appropriate; may be null
//@default_icon Default attachment menu icon for the bot in SVG format; may be null
@ -2564,7 +2565,7 @@ attachmentMenuBotColor light_color:int32 dark_color:int32 = AttachmentMenuBotCol
//@android_icon Attachment menu icon for the bot in TGS format for the official Android app; may be null
//@macos_icon Attachment menu icon for the bot in TGS format for the official native macOS app; may be null
//@icon_color Color to highlight selected icon of the bot if appropriate; may be null
attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file android_icon:file macos_icon:file icon_color:attachmentMenuBotColor = AttachmentMenuBot;
attachmentMenuBot bot_user_id:int53 supports_self_chat:Bool supports_user_chats:Bool supports_bot_chats:Bool supports_group_chats:Bool supports_channel_chats:Bool supports_settings:Bool name:string name_color:attachmentMenuBotColor default_icon:file ios_static_icon:file ios_animated_icon:file android_icon:file macos_icon:file icon_color:attachmentMenuBotColor = AttachmentMenuBot;
//@description Information about the message sent by answerWebAppQuery @inline_message_id Identifier of the sent inline message, if known
sentWebAppMessage inline_message_id:string = SentWebAppMessage;

View File

@ -294,7 +294,8 @@ bool operator==(const AttachMenuManager::AttachMenuBot &lhs, const AttachMenuMan
lhs.supports_user_dialogs_ == rhs.supports_user_dialogs_ &&
lhs.supports_bot_dialogs_ == rhs.supports_bot_dialogs_ &&
lhs.supports_group_dialogs_ == rhs.supports_group_dialogs_ &&
lhs.supports_broadcast_dialogs_ == rhs.supports_broadcast_dialogs_ && lhs.name_ == rhs.name_ &&
lhs.supports_broadcast_dialogs_ == rhs.supports_broadcast_dialogs_ &&
lhs.supports_settings_ == rhs.supports_settings_ && lhs.name_ == rhs.name_ &&
lhs.default_icon_file_id_ == rhs.default_icon_file_id_ &&
lhs.ios_static_icon_file_id_ == rhs.ios_static_icon_file_id_ &&
lhs.ios_animated_icon_file_id_ == rhs.ios_animated_icon_file_id_ &&
@ -329,6 +330,7 @@ void AttachMenuManager::AttachMenuBot::store(StorerT &storer) const {
STORE_FLAG(supports_bot_dialogs_);
STORE_FLAG(supports_group_dialogs_);
STORE_FLAG(supports_broadcast_dialogs_);
STORE_FLAG(supports_settings_);
END_STORE_FLAGS();
td::store(user_id_, storer);
td::store(name_, storer);
@ -376,6 +378,7 @@ void AttachMenuManager::AttachMenuBot::parse(ParserT &parser) {
PARSE_FLAG(supports_bot_dialogs_);
PARSE_FLAG(supports_group_dialogs_);
PARSE_FLAG(supports_broadcast_dialogs_);
PARSE_FLAG(supports_settings_);
END_PARSE_FLAGS();
td::parse(user_id_, parser);
td::parse(name_, parser);
@ -742,6 +745,7 @@ Result<AttachMenuManager::AttachMenuBot> AttachMenuManager::get_attach_menu_bot(
break;
}
}
attach_menu_bot.supports_settings_ = bot->has_settings_;
if (!attach_menu_bot.default_icon_file_id_.is_valid()) {
return Status::Error(PSLICE() << "Have no default icon for " << user_id);
}
@ -944,9 +948,10 @@ td_api::object_ptr<td_api::attachmentMenuBot> AttachMenuManager::get_attachment_
return td_api::make_object<td_api::attachmentMenuBot>(
td_->contacts_manager_->get_user_id_object(bot.user_id_, "get_attachment_menu_bot_object"),
bot.supports_self_dialog_, bot.supports_user_dialogs_, bot.supports_bot_dialogs_, bot.supports_group_dialogs_,
bot.supports_broadcast_dialogs_, bot.name_, get_attach_menu_bot_color_object(bot.name_color_),
get_file(bot.default_icon_file_id_), get_file(bot.ios_static_icon_file_id_),
get_file(bot.ios_animated_icon_file_id_), get_file(bot.android_icon_file_id_), get_file(bot.macos_icon_file_id_),
bot.supports_broadcast_dialogs_, bot.supports_settings_, bot.name_,
get_attach_menu_bot_color_object(bot.name_color_), get_file(bot.default_icon_file_id_),
get_file(bot.ios_static_icon_file_id_), get_file(bot.ios_animated_icon_file_id_),
get_file(bot.android_icon_file_id_), get_file(bot.macos_icon_file_id_),
get_attach_menu_bot_color_object(bot.icon_color_));
}

View File

@ -80,6 +80,7 @@ class AttachMenuManager final : public Actor {
bool supports_bot_dialogs_ = false;
bool supports_group_dialogs_ = false;
bool supports_broadcast_dialogs_ = false;
bool supports_settings_ = false;
string name_;
AttachMenuBotColor name_color_;
FileId default_icon_file_id_;