tg_flows/types/
menu_button.rs

1use serde::{Deserialize, Serialize};
2
3use crate::types::WebAppInfo;
4
5/// This object describes the bot's menu button in a private chat.
6///
7/// If a menu button other than `MenuButton::Default` is set for a private chat,
8/// then it is applied in the chat. Otherwise the default menu button is
9/// applied. By default, the menu button opens the list of bot commands.
10#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
11#[serde(rename_all = "snake_case")]
12#[serde(tag = "type")]
13pub enum MenuButton {
14    /// Represents a menu button, which opens the bot's list of commands.
15    Commands,
16
17    /// Represents a menu button, which launches a [Web App].
18    ///
19    /// [Web App]: https://core.telegram.org/bots/webapps
20    WebApp {
21        /// Text on the button.
22        text: String,
23
24        /// Description of the Web App that will be launched when the user
25        /// presses the button. The Web App will be able to send an arbitrary
26        /// message on behalf of the user using the method
27        /// [`AnswerWebAppQuery`].
28        ///
29        /// [`AnswerWebAppQuery`]: crate::payloads::AnswerWebAppQuery
30        web_app: WebAppInfo,
31    },
32
33    /// Describes that no specific value for the menu button was set.
34    Default,
35}