pub struct AnswerCallbackQuery { /* private fields */ }
Expand description
Sends an answer to a callback query sent from an inline keyboard.
The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
Alternatively, the user can be redirected to the specified Game URL.
For this option to work, you must first create a game for your bot via Bot Father and accept the terms.
Otherwise, you may use links like t.me/your_bot?start=XXX
that open your bot with a parameter.
Implementations§
Source§impl AnswerCallbackQuery
impl AnswerCallbackQuery
Sourcepub fn new<T>(callback_query_id: T) -> Self
pub fn new<T>(callback_query_id: T) -> Self
Creates a new AnswerCallbackQuery
.
§Arguments
callback_query_id
- Unique identifier of the query to be answered.
Sourcepub fn with_cache_time(self, value: Integer) -> Self
pub fn with_cache_time(self, value: Integer) -> Self
Sets a new cache time.
§Arguments
value
- The maximum amount of time in seconds that the result of the callback query may be cached client-side; telegram apps will support caching starting in version 3.14; default - 0.
Sourcepub fn with_show_alert(self, value: bool) -> Self
pub fn with_show_alert(self, value: bool) -> Self
Sets a new value for the short_alert
flag.
§Arguments
value
- An alert will be shown by the client instead of a notification at the top of the chat screen; default -false
.
Sourcepub fn with_text<T>(self, value: T) -> Self
pub fn with_text<T>(self, value: T) -> Self
Sets a new text.
§Arguments
value
- Text of the notification; if not specified, nothing will be shown to the user; 0-200 characters.
Sourcepub fn with_url<T>(self, value: T) -> Self
pub fn with_url<T>(self, value: T) -> Self
Sets a new URL.
§Arguments
value
- URL that will be opened by the user’s client.
If you have created a game and accepted the conditions via Bot Father, specify the URL that opens your game – note that this will only work if the query comes from a callback game button.
Otherwise, you may use links like t.me/your_bot?start=XXX
that open your bot with a parameter.
Trait Implementations§
Source§impl Clone for AnswerCallbackQuery
impl Clone for AnswerCallbackQuery
Source§fn clone(&self) -> AnswerCallbackQuery
fn clone(&self) -> AnswerCallbackQuery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more