Struct botapi::gen_types::InlineKeyboardButtonBuilder
source · pub struct InlineKeyboardButtonBuilder {
pub text: String,
pub url: Option<String>,
pub callback_data: Option<String>,
pub web_app: Option<BoxWrapper<Unbox<WebAppInfo>>>,
pub login_url: Option<BoxWrapper<Unbox<LoginUrl>>>,
pub switch_inline_query: Option<String>,
pub switch_inline_query_current_chat: Option<String>,
pub switch_inline_query_chosen_chat: Option<BoxWrapper<Unbox<SwitchInlineQueryChosenChat>>>,
pub callback_game: Option<BoxWrapper<Unbox<CallbackGame>>>,
pub pay: Option<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.
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 the button is pressed, 1-64 bytes
web_app: Option<BoxWrapper<Unbox<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<BoxWrapper<Unbox<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<BoxWrapper<Unbox<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<BoxWrapper<Unbox<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: Option<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 InlineKeyboardButtonBuilder
impl InlineKeyboardButtonBuilder
pub fn new(text: String) -> Self
sourcepub fn set_url(self, url: String) -> Self
pub fn set_url(self, url: String) -> Self
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.
sourcepub fn set_callback_data(self, callback_data: String) -> Self
pub fn set_callback_data(self, callback_data: String) -> Self
Optional. Data to be sent in a callback query to the bot when the button is pressed, 1-64 bytes
sourcepub fn set_web_app(self, web_app: WebAppInfo) -> Self
pub fn set_web_app(self, web_app: WebAppInfo) -> Self
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.
sourcepub fn set_login_url(self, login_url: LoginUrl) -> Self
pub fn set_login_url(self, login_url: LoginUrl) -> Self
Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
sourcepub fn set_switch_inline_query(self, switch_inline_query: String) -> Self
pub fn set_switch_inline_query(self, switch_inline_query: String) -> Self
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.
sourcepub fn set_switch_inline_query_current_chat(
self,
switch_inline_query_current_chat: String,
) -> Self
pub fn set_switch_inline_query_current_chat( self, switch_inline_query_current_chat: String, ) -> Self
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.
sourcepub fn set_switch_inline_query_chosen_chat(
self,
switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat,
) -> Self
pub fn set_switch_inline_query_chosen_chat( self, switch_inline_query_chosen_chat: SwitchInlineQueryChosenChat, ) -> Self
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.
sourcepub fn set_callback_game(self, callback_game: CallbackGame) -> Self
pub fn set_callback_game(self, callback_game: CallbackGame) -> Self
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.
sourcepub fn set_pay(self, pay: bool) -> Self
pub fn set_pay(self, pay: bool) -> Self
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.
pub fn build(self) -> InlineKeyboardButton
Trait Implementations§
source§impl Clone for InlineKeyboardButtonBuilder
impl Clone for InlineKeyboardButtonBuilder
source§fn clone(&self) -> InlineKeyboardButtonBuilder
fn clone(&self) -> InlineKeyboardButtonBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InlineKeyboardButtonBuilder
impl Debug for InlineKeyboardButtonBuilder
source§impl Default for InlineKeyboardButtonBuilder
impl Default for InlineKeyboardButtonBuilder
source§fn default() -> InlineKeyboardButtonBuilder
fn default() -> InlineKeyboardButtonBuilder
source§impl<'de> Deserialize<'de> for InlineKeyboardButtonBuilder
impl<'de> Deserialize<'de> for InlineKeyboardButtonBuilder
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Hash for InlineKeyboardButtonBuilder
impl Hash for InlineKeyboardButtonBuilder
source§impl Ord for InlineKeyboardButtonBuilder
impl Ord for InlineKeyboardButtonBuilder
source§fn cmp(&self, other: &InlineKeyboardButtonBuilder) -> Ordering
fn cmp(&self, other: &InlineKeyboardButtonBuilder) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for InlineKeyboardButtonBuilder
impl PartialEq for InlineKeyboardButtonBuilder
source§fn eq(&self, other: &InlineKeyboardButtonBuilder) -> bool
fn eq(&self, other: &InlineKeyboardButtonBuilder) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for InlineKeyboardButtonBuilder
impl PartialOrd for InlineKeyboardButtonBuilder
source§fn partial_cmp(&self, other: &InlineKeyboardButtonBuilder) -> Option<Ordering>
fn partial_cmp(&self, other: &InlineKeyboardButtonBuilder) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for InlineKeyboardButtonBuilder
impl StructuralPartialEq for InlineKeyboardButtonBuilder
Auto Trait Implementations§
impl Freeze for InlineKeyboardButtonBuilder
impl RefUnwindSafe for InlineKeyboardButtonBuilder
impl Send for InlineKeyboardButtonBuilder
impl Sync for InlineKeyboardButtonBuilder
impl Unpin for InlineKeyboardButtonBuilder
impl UnwindSafe for InlineKeyboardButtonBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.