#[non_exhaustive]pub struct KeyboardButton {
pub text: String,
pub request_contact: Option<bool>,
pub request_location: Option<bool>,
pub request_poll: Option<KeyboardButtonPollType>,
pub web_app: Option<WebAppInfo>,
pub request_users: Option<KeyboardButtonRequestUsers>,
pub request_chat: Option<KeyboardButtonRequestChat>,
pub request_managed_bot: Option<KeyboardButtonRequestManagedBot>,
pub style: Option<String>,
pub icon_custom_emoji_id: Option<String>,
}Expand description
One button of a reply keyboard.
For simple text buttons text is the only field needed; the other optional
fields are mutually exclusive and enable richer interactions.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.text: StringLabel text shown on the button.
request_contact: Option<bool>If true, the user’s phone number is sent when the button is pressed.
request_location: Option<bool>If true, the user’s current location is sent when the button is pressed.
request_poll: Option<KeyboardButtonPollType>If set, the user is asked to create a poll and send it to the bot.
web_app: Option<WebAppInfo>If set, the described Web App is launched when the button is pressed.
request_users: Option<KeyboardButtonRequestUsers>If set, pressing the button opens a user-selection list.
request_chat: Option<KeyboardButtonRequestChat>If set, pressing the button opens a chat-selection list.
request_managed_bot: Option<KeyboardButtonRequestManagedBot>If specified, pressing the button will ask the user to create and share a bot that will be managed by the current bot. Available in private chats only.
Added in Bot API 9.6.
style: Option<String>Visual style for the button: "primary", "success", or "danger".
icon_custom_emoji_id: Option<String>Unique identifier of the custom emoji shown before the button text.
Implementations§
Source§impl KeyboardButton
impl KeyboardButton
Sourcepub fn text(text: impl Into<String>) -> KeyboardButton
pub fn text(text: impl Into<String>) -> KeyboardButton
Create a simple text button.
Sourcepub fn request_contact(text: impl Into<String>) -> KeyboardButton
pub fn request_contact(text: impl Into<String>) -> KeyboardButton
Create a button that requests the user’s phone contact when pressed.
Sourcepub fn request_location(text: impl Into<String>) -> KeyboardButton
pub fn request_location(text: impl Into<String>) -> KeyboardButton
Create a button that requests the user’s location when pressed.
Trait Implementations§
Source§impl Clone for KeyboardButton
impl Clone for KeyboardButton
Source§fn clone(&self) -> KeyboardButton
fn clone(&self) -> KeyboardButton
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more