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
use crate::{
methods::AnswerInlineQuery,
types::{inline_query, InlineQuery, Location, User},
Bot,
};
use std::sync::Arc;
common! {
struct Inline {
id: inline_query::Id,
from: User,
location: Option<Location>,
query: String,
offset: String,
}
}
impl Inline {
#[allow(clippy::missing_const_for_fn)]
pub(crate) fn new(bot: Arc<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,
}
}
pub fn answer<'a>(
&'a self,
results: &'a [inline_query::Result<'a>],
) -> AnswerInlineQuery<'a> {
self.bot.answer_inline_query(self.id.as_ref(), results)
}
}