Skip to main content

Button

Struct Button 

Source
pub struct Button {
    pub raw: KeyboardButton,
}
Expand description

Inline button to be used as the reply markup underneath a message.

Fields§

§raw: KeyboardButton

Implementations§

Source§

impl Button

Source

pub fn data<T: Into<String>, B: Into<Vec<u8>>>(text: T, bytes: B) -> Button

Creates a button that will trigger a crate::update::CallbackQuery when clicked.

Although any combination of bytes can be used (including null, and not just UTF-8), there is a limit to how long the payload data can be (see the description for the callback_data field for an up-to-date value). If you need to store more data than that, consider storing the real data in some form of database, and a reference to that data’s row in the button’s payload.

Both the text and bytes data must be non-empty.

Source

pub fn switch<T: Into<String>, Q: Into<String>>(text: T, query: Q) -> Button

Creates a button to force the user to switch to inline mode (perform inline queries).

Pressing the button will insert the bot’s username and the specified inline query in the input field.

Source

pub fn switch_elsewhere<T: Into<String>, Q: Into<String>>( text: T, query: Q, ) -> Button

Creates a button identical to Self::switch, except the user will be prompted to select a different peer.

Pressing the button will prompt the user to select one of their peers, open that peer and insert the bot’s username and the specified inline query in the input field.

Source

pub fn url<T: Into<String>, U: Into<String>>(text: T, url: U) -> Button

Creates a button that when clicked will ask the user if they want to open the specified URL.

The URL will be visible to the user before it’s opened unless it’s trusted (such as Telegram’s domain).

Source

pub fn webview<T: Into<String>, U: Into<String>>(text: T, url: U) -> Button

Creates a button that when clicked will open the specified URL in an in-app browser.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.