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
87
88
89
90
91
92
93
94
95
96
use serde::{Deserialize, Serialize};
#[serde_with_macros::skip_serializing_none]
#[derive(Copy, Clone, Default, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct ChatPermissions {
pub can_send_messages: Option<bool>,
pub can_send_media_messages: Option<bool>,
pub can_send_polls: Option<bool>,
pub can_send_other_messages: Option<bool>,
pub can_add_web_page_previews: Option<bool>,
pub can_change_info: Option<bool>,
pub can_invite_users: Option<bool>,
pub can_pin_messages: Option<bool>,
}
impl ChatPermissions {
pub const fn new() -> Self {
Self {
can_send_messages: None,
can_send_media_messages: None,
can_send_polls: None,
can_send_other_messages: None,
can_add_web_page_previews: None,
can_change_info: None,
can_invite_users: None,
can_pin_messages: None,
}
}
pub const fn can_send_messages(mut self, val: bool) -> Self {
self.can_send_messages = Some(val);
self
}
pub const fn can_send_media_messages(mut self, val: bool) -> Self {
self.can_send_media_messages = Some(val);
self
}
pub const fn can_send_polls(mut self, val: bool) -> Self {
self.can_send_polls = Some(val);
self
}
pub const fn can_send_other_messages(mut self, val: bool) -> Self {
self.can_send_other_messages = Some(val);
self
}
pub const fn can_add_web_page_previews(mut self, val: bool) -> Self {
self.can_add_web_page_previews = Some(val);
self
}
pub const fn can_change_info(mut self, val: bool) -> Self {
self.can_change_info = Some(val);
self
}
pub const fn can_invite_users(mut self, val: bool) -> Self {
self.can_invite_users = Some(val);
self
}
pub const fn can_pin_messages(mut self, val: bool) -> Self {
self.can_pin_messages = Some(val);
self
}
}