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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
macro_rules! edited_message {
(
struct $name:ident {
#[doc = $media_doc:literal] $media:ident: $media_type:ty,
$(#[doc = $field_doc:literal] $field:ident: $type:ty,)*
} -> EventLoop::$handler:ident
fn new(
$($param:ident: $param_type:ty,)*
) -> Self {
Self {
$($new_field:ident: $value:expr,)*
}
}
) => {
message_base! {
struct $name {
reply_to: Option<crate::types::Message>,
author_signature: Option<String>,
edit_date: i64,
reply_markup: Option<crate::types::keyboard::inline::Keyboard>,
via_bot: Option<crate::types::User>,
#[doc = $media_doc]
$media: $media_type,
$(#[doc = $field_doc] $field: $type,)*
} -> EventLoop::$handler
fn new(
edit_date: i64,
$media: $media_type,
$($param: $param_type,)*
) -> Self {
infer reply_to;
infer author_signature;
infer reply_markup;
infer via_bot;
Self {
edit_date: edit_date,
$media: $media,
$($new_field: $value,)*
}
}
}
impl super::methods::Copyable for $name {}
impl super::methods::Forwardable for $name {}
impl super::methods::Pinnable for $name {}
impl crate::contexts::fields::MediaMessage for $name {
#[must_use]
fn reply_to(&self) -> Option<&crate::types::Message> {
self.reply_to.as_ref()
}
#[must_use]
fn author_signature(&self) -> Option<&str> {
self.author_signature.as_ref().map(String::as_str)
}
#[must_use]
fn reply_markup(
&self
) -> Option<&crate::types::keyboard::inline::Keyboard> {
self.reply_markup.as_ref()
}
#[must_use]
fn via_bot(&self) -> Option<&crate::types::User> {
self.via_bot.as_ref()
}
}
impl crate::contexts::fields::EditedMessage for $name {
#[must_use]
fn edit_date(&self) -> i64 {
self.edit_date
}
}
};
}