Struct carapax::types::KeyboardButton
source · pub struct KeyboardButton { /* private fields */ }
Expand description
Represents a button of the reply keyboard.
Implementations§
source§impl KeyboardButton
impl KeyboardButton
sourcepub fn new<T>(text: T) -> KeyboardButton
pub fn new<T>(text: T) -> KeyboardButton
Creates a new KeyboardButton
.
§Arguments
text
- Text of the button.
If none of the optional fields are used, it will be sent as a message when the button is pressed.
sourcepub fn with_request_chat(
self,
value: KeyboardButtonRequestChat
) -> KeyboardButton
pub fn with_request_chat( self, value: KeyboardButtonRequestChat ) -> KeyboardButton
Changes button type to a chat request.
§Arguments
value
- Criteria used to request a suitable chat.
If specified, pressing the button will open a list of suitable chats.
Tapping on a chat will send its identifier
to the bot in a crate::types::MessageData::ChatShared
message.
Available in private chats only.
sourcepub fn with_request_contact(self) -> KeyboardButton
pub fn with_request_contact(self) -> KeyboardButton
Changes button type to a contact request.
The user’s phone number will be sent as a contact when the button is pressed.
Available in private chats only.
sourcepub fn with_request_location(self) -> KeyboardButton
pub fn with_request_location(self) -> KeyboardButton
Changes button type to a location request.
The user’s current location will be sent when the button is pressed.
Available in private chats only.
sourcepub fn with_request_poll<T>(self, button_type: T) -> KeyboardButtonwhere
T: Into<KeyboardButtonPollType>,
pub fn with_request_poll<T>(self, button_type: T) -> KeyboardButtonwhere
T: Into<KeyboardButtonPollType>,
Changes button type to a poll request.
§Arguments
value
- Type of a poll.
The user will be asked to create a poll and send it to the bot when the button is pressed. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
Available in private chats only.
sourcepub fn with_request_users(
self,
value: KeyboardButtonRequestUsers
) -> KeyboardButton
pub fn with_request_users( self, value: KeyboardButtonRequestUsers ) -> KeyboardButton
Changes button type to a user request.
§Arguments
value
- Criteria used to request a suitable user.
If specified, pressing the button will open a list of suitable users.
Tapping on any user will send their identifier
to the bot in a crate::types::MessageData::UsersShared
message.
Available in private chats only.
sourcepub fn with_web_app(self, web_app_info: WebAppInfo) -> KeyboardButton
pub fn with_web_app(self, web_app_info: WebAppInfo) -> KeyboardButton
Changes button type to a web app.
§Arguments
value
- The Web App that will be launched when the button is pressed.
The Web App will be able to send a crate::types::MessageData::WebAppData
message.
Available in private chats only.
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 moresource§impl Debug for KeyboardButton
impl Debug for KeyboardButton
source§impl<'de> Deserialize<'de> for KeyboardButton
impl<'de> Deserialize<'de> for KeyboardButton
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<KeyboardButton, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<KeyboardButton, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for KeyboardButton
impl PartialEq for KeyboardButton
source§fn eq(&self, other: &KeyboardButton) -> bool
fn eq(&self, other: &KeyboardButton) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for KeyboardButton
impl PartialOrd for KeyboardButton
source§fn partial_cmp(&self, other: &KeyboardButton) -> Option<Ordering>
fn partial_cmp(&self, other: &KeyboardButton) -> 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 moresource§impl Serialize for KeyboardButton
impl Serialize for KeyboardButton
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 KeyboardButton
Auto Trait Implementations§
impl Freeze for KeyboardButton
impl RefUnwindSafe for KeyboardButton
impl Send for KeyboardButton
impl Sync for KeyboardButton
impl Unpin for KeyboardButton
impl UnwindSafe for KeyboardButton
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