pub struct InlineKeyboardButton {
    pub text: String,
    pub url: Option<String>,
    pub callback_data: Option<String>,
    pub web_app: Option<WebAppInfo>,
    pub login_url: Option<LoginUrl>,
    pub switch_inline_query: Option<String>,
    pub switch_inline_query_current_chat: Option<String>,
    pub switch_inline_query_chosen_chat: Option<SwitchInlineQueryChosenChat>,
    pub callback_game: Option<CallbackGame>,
    pub pay: bool,
}
Expand description

This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button. API Reference: link

Fields§

§text: String

Label text on the button

§url: Option<String>

Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.

§callback_data: Option<String>

Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.

§web_app: Option<WebAppInfo>

Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.

§login_url: Option<LoginUrl>

Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.

§switch_inline_query: Option<String>

Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted. Not supported for messages sent on behalf of a Telegram Business account.

§switch_inline_query_current_chat: Option<String>

Optional. If set, pressing the button will insert the bot’s username and the specified inline query in the current chat’s input field. May be empty, in which case only the bot’s username will be inserted.

This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. Not supported in channels and for messages sent on behalf of a Telegram Business account.

§switch_inline_query_chosen_chat: Option<SwitchInlineQueryChosenChat>

Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot’s username and the specified inline query in the input field. Not supported for messages sent on behalf of a Telegram Business account.

§callback_game: Option<CallbackGame>

Optional. Description of the game that will be launched when the user presses the button.

NOTE: This type of button must always be the first button in the first row.

§pay: bool

Optional. Specify True, to send a Pay button. Substrings “⭐” and “XTR” in the buttons’s text will be replaced with a Telegram Star icon.

NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.

Implementations§

source§

impl InlineKeyboardButton

source

pub fn switch_inline_query_current_chat( text: impl Into<String>, query: impl Into<String>, ) -> Self

source

pub fn switch_inline_query_chosen_chat( text: impl Into<String>, query: impl Into<SwitchInlineQueryChosenChat>, ) -> Self

source

pub fn switch_inline_query( text: impl Into<String>, query: impl Into<String>, ) -> Self

source

pub fn callback(text: impl Into<String>, data: impl Into<String>) -> Self

Trait Implementations§

source§

impl Clone for InlineKeyboardButton

source§

fn clone(&self) -> InlineKeyboardButton

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for InlineKeyboardButton

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for InlineKeyboardButton

source§

fn default() -> InlineKeyboardButton

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for InlineKeyboardButton

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for InlineKeyboardButton

source§

fn eq(&self, other: &InlineKeyboardButton) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for InlineKeyboardButton

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for InlineKeyboardButton

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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WrapRequest for T

source§

fn wrap<ReturnType>( &self, ) -> impl Future<Output = Result<ReturnType, ConogramError>>
where for<'a> &'a Self: IntoFuture<Output = Result<ReturnType, ConogramError>>, Self: Sized,

source§

fn wrap_background<ReturnType>(self)
where for<'a> &'a Self: IntoFuture<Output = Result<ReturnType, ConogramError>> + Send + Sync, Self: IntoFuture<Output = Result<ReturnType, ConogramError>> + Send + Sync + Sized + 'static, ReturnType: Send, for<'a> <&'a Self as IntoFuture>::IntoFuture: Send,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,