Skip to main content

telexide_fork/model/
inline.rs

1//! Note: It is necessary to enable [inline feedback] via [@Botfather] in order
2//! to receive these objects in updates.
3//!
4//! [inline feedback]: https://core.telegram.org/bots/inline#collecting-feedback
5//! [@Botfather]: https://t.me/botfather
6
7use super::{ChatType, Location, User};
8use serde::{Deserialize, Serialize};
9
10/// This object represents an incoming inline query.
11/// When the user sends an empty query, your bot could return some default or
12/// trending results.
13#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
14pub struct InlineQuery {
15    /// Unique identifier for this query
16    pub id: String,
17    /// Sender
18    pub from: User,
19    /// Sender location, only for bots that request user location
20    pub location: Option<Location>,
21    /// Text of the query (up to 256 characters)
22    pub query: String,
23    /// Offset of the results to be returned, can be controlled by the bot
24    pub offset: String,
25    /// Type of the chat, from which the inline query was sent. Can be either “sender” for a
26    /// private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”.
27    /// The chat type should be always known for requests sent from official clients and most
28    /// third-party clients, unless the request was sent from a secret chat.
29    pub chat_type: Option<ChatType>,
30}
31
32/// Represents a result of an inline query that was chosen by the user and sent
33/// to their chat partner.
34#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
35pub struct ChosenInlineResult {
36    /// The unique identifier for the result that was chosen
37    pub result_id: String,
38    /// The user that chose the result
39    pub from: User,
40    /// Sender location, only for bots that require user location
41    pub location: Option<Location>,
42    /// Identifier of the sent inline message.
43    /// Available only if there is an inline keyboard attached to the message.
44    /// Will be also received in callback queries and can be used to edit the
45    /// message.
46    pub query: String,
47    /// The query that was used to obtain the result
48    pub inline_message_id: Option<String>,
49}