机器人附件菜单和侧边菜单项

机器人可以安装附件菜单和侧边菜单项,提供方便易用、功能多样的迷你应用程序。

模式:

user#20b1422 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector<Username> stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User;attachMenuBotsBot#93bf667f bot:AttachMenuBot users:Vector<User> = AttachMenuBotsBot;attachMenuBot#d90d8dfe flags:# inactive:flags.0?true has_settings:flags.1?true request_write_access:flags.2?true show_in_attach_menu:flags.3?true show_in_side_menu:flags.4?true side_menu_disclaimer_needed:flags.5?true bot_id:long short_name:string peer_types:flags.3?Vector<AttachMenuPeerType> icons:Vector<AttachMenuBotIcon> = AttachMenuBot;attachMenuPeerTypeSameBotPM#7d6be90e = AttachMenuPeerType; attachMenuPeerTypeBotPM#c32bfa1a = AttachMenuPeerType; attachMenuPeerTypePM#f146d31f = AttachMenuPeerType; attachMenuPeerTypeChat#509113f = AttachMenuPeerType; attachMenuPeerTypeBroadcast#7bfbdefc = AttachMenuPeerType;attachMenuBotIcon#b2a7386b flags:# name:string icon:Document colors:flags.0?Vector<AttachMenuBotIconColor> = AttachMenuBotIcon;attachMenuBotIconColor#4576f3f0 name:string color:int = AttachMenuBotIconColor;updateAttachMenuBots#17b7a20b = Update;attachMenuBotsNotModified#f1d88a5c = AttachMenuBots; attachMenuBots#3c4301c0 hash:long bots:Vector<AttachMenuBot> users:Vector<User> = AttachMenuBots;---functions---messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot;messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool;messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots;

设置了该标志的机器人bot_attach_menu会提供一个附件或侧边菜单项,可以将其添加到应用内附件菜单或主视图侧边菜单中。

使用messages.getAttachMenuBot获取有关给定机器人的附件/侧边菜单项的信息,有关更多信息,请参阅 attachMenuBot 构造函数页面 »。

可以使用messages.getAttachMenuBots获取当前已安装的附件/侧边菜单列表。

使用`messages.toggleBotInAttachMenu`可以启用或禁用特定机器人的附件和/或侧边菜单(需要安装或卸载的条目取决于 `attachMenuBot` 和 `attachMenuBot` 标志的值)。show_in_attach_menu使用此方法show_in_side_menu所做
的更改将触发其他客户端中的`updateAttachMenuBots`更新,进而触发 `messages.getAttachMenuBots`调用以获取已安装附件/侧边菜单条目的完整更新列表。
如果用户在设置中更改了应用程序的语言,附件/侧边菜单列表也应刷新。

一旦为某个用户启用附件/侧边菜单,attach_menu_enabled就会为机器人设置用户标志,并取消设置attachMenuBot标志。inactive

点击附件/侧边菜单项应该会打开相关的附件菜单小程序,请点击此处»和此处»查看所需步骤的更多信息。

附件菜单可以通过附件/侧边菜单深度链接安装和打开。

具体来说,点击此类链接时,应调用messages.getAttachMenuBot来检查机器人是否具有关联的附件/侧边菜单项,如果有: