Struct carapax::types::InlineKeyboardButton
source · pub struct InlineKeyboardButton { /* private fields */ }
Expand description
Represents a button of an inline keyboard.
Implementations§
source§impl InlineKeyboardButton
impl InlineKeyboardButton
sourcepub fn for_callback_data<A, B>(text: A, data: B) -> InlineKeyboardButton
pub fn for_callback_data<A, B>(text: A, data: B) -> InlineKeyboardButton
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the button.data
- Data to be sent in a callback query to the bot when button is pressed; 1-64 bytes.
sourcepub fn for_callback_data_struct<A, B>(
text: A,
data: &B
) -> Result<InlineKeyboardButton, InlineKeyboardError>
pub fn for_callback_data_struct<A, B>( text: A, data: &B ) -> Result<InlineKeyboardButton, InlineKeyboardError>
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the button.data
- Data to be sent in a callback query.
Same as Self::for_callback_data
, but takes a serializable type.
Data will be serialized using serde_json
.
sourcepub fn for_callback_game<T>(text: T) -> InlineKeyboardButton
pub fn for_callback_game<T>(text: T) -> InlineKeyboardButton
sourcepub fn for_login_url<A, B>(text: A, data: B) -> InlineKeyboardButton
pub fn for_login_url<A, B>(text: A, data: B) -> InlineKeyboardButton
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the button.data
- An HTTPs URL used to automatically authorize the user.
Can be used as a replacement for the Telegram Login Widget.
sourcepub fn for_pay<T>(text: T) -> InlineKeyboardButton
pub fn for_pay<T>(text: T) -> InlineKeyboardButton
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the button.
Represents a pay button.
https://core.telegram.org/bots/payments
§Notes
This type of button must always be the first button in the first row and can only be used in invoice messages.
sourcepub fn for_switch_inline_query<A, B>(text: A, data: B) -> InlineKeyboardButton
pub fn for_switch_inline_query<A, B>(text: A, data: B) -> InlineKeyboardButton
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the button.data
- Text of an inline query.
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.
Can be empty, in which case just the bot’s username will be inserted.
§Notes
This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it.
Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.
sourcepub fn for_switch_inline_query_chosen_chat<T>(
text: T,
data: SwitchInlineQueryChosenChat
) -> InlineKeyboardButton
pub fn for_switch_inline_query_chosen_chat<T>( text: T, data: SwitchInlineQueryChosenChat ) -> InlineKeyboardButton
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the button.data
- Inline query parameters.
Pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot username and the specified inline query in the input field.
sourcepub fn for_switch_inline_query_current_chat<A, B>(
text: A,
data: B
) -> InlineKeyboardButton
pub fn for_switch_inline_query_current_chat<A, B>( text: A, data: B ) -> InlineKeyboardButton
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the button.data
- Text of an inline query.
Pressing the button will insert the bot‘s username and the specified inline query in the current chat’s input field.
Can 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.
sourcepub fn for_url<A, B>(text: A, data: B) -> InlineKeyboardButton
pub fn for_url<A, B>(text: A, data: B) -> InlineKeyboardButton
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the buttondata
- HTTP ortg://
URL to be opened when button is pressed.
sourcepub fn for_web_app<T>(text: T, data: WebAppInfo) -> InlineKeyboardButton
pub fn for_web_app<T>(text: T, data: WebAppInfo) -> InlineKeyboardButton
Creates a new InlineKeyboardButton
.
§Arguments
text
- Text of the button.data
- Description of the Web App that will be launched when the user presses the button.
Returns the type of the button.
Trait Implementations§
source§impl Clone for InlineKeyboardButton
impl Clone for InlineKeyboardButton
source§fn clone(&self) -> InlineKeyboardButton
fn clone(&self) -> InlineKeyboardButton
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InlineKeyboardButton
impl Debug for InlineKeyboardButton
source§impl<'de> Deserialize<'de> for InlineKeyboardButton
impl<'de> Deserialize<'de> for InlineKeyboardButton
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<InlineKeyboardButton, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<InlineKeyboardButton, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for InlineKeyboardButton
impl PartialEq for InlineKeyboardButton
source§fn eq(&self, other: &InlineKeyboardButton) -> bool
fn eq(&self, other: &InlineKeyboardButton) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for InlineKeyboardButton
impl Serialize for InlineKeyboardButton
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for InlineKeyboardButton
Auto Trait Implementations§
impl Freeze for InlineKeyboardButton
impl RefUnwindSafe for InlineKeyboardButton
impl Send for InlineKeyboardButton
impl Sync for InlineKeyboardButton
impl Unpin for InlineKeyboardButton
impl UnwindSafe for InlineKeyboardButton
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more