1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use crate::{
methods::AnswerInlineQuery,
types::{inline_query, InlineQuery, Location, User},
Bot,
};
common! {
struct Inline {
id: inline_query::Id,
from: User,
location: Option<Location>,
query: String,
offset: String,
chat_kind: Option<inline_query::ChatKind>,
}
}
impl Inline {
#[allow(clippy::missing_const_for_fn)]
pub(crate) fn new(bot: Bot, inline_query: InlineQuery) -> Self {
Self {
bot,
id: inline_query.id,
from: inline_query.from,
location: inline_query.location,
query: inline_query.query,
offset: inline_query.offset,
chat_kind: inline_query.chat_kind,
}
}
pub fn answer(
&self,
results: impl Into<Vec<inline_query::Result>>,
) -> AnswerInlineQuery<'_> {
self.bot.answer_inline_query(self.id.clone(), results)
}
}