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
use serde::{Deserialize, Serialize};
use crate::entities::user::User;
/// Represents a [chat member](https://core.telegram.org/bots/api/#chatmember) that is under certain restrictions in the chat. Supergroups only.
///
/// API Reference: [link](https://core.telegram.org/bots/api/#chatmemberrestricted)
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ChatMemberRestricted {
/// Information about the user
pub user: User,
/// *True*, if the user is a member of the chat at the moment of the request
pub is_member: bool,
/// *True*, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues
pub can_send_messages: bool,
/// *True*, if the user is allowed to send audios
pub can_send_audios: bool,
/// *True*, if the user is allowed to send documents
pub can_send_documents: bool,
/// *True*, if the user is allowed to send photos
pub can_send_photos: bool,
/// *True*, if the user is allowed to send videos
pub can_send_videos: bool,
/// *True*, if the user is allowed to send video notes
pub can_send_video_notes: bool,
/// *True*, if the user is allowed to send voice notes
pub can_send_voice_notes: bool,
/// *True*, if the user is allowed to send polls
pub can_send_polls: bool,
/// *True*, if the user is allowed to send animations, games, stickers and use inline bots
pub can_send_other_messages: bool,
/// *True*, if the user is allowed to add web page previews to their messages
pub can_add_web_page_previews: bool,
/// *True*, if the user is allowed to change the chat title, photo and other settings
pub can_change_info: bool,
/// *True*, if the user is allowed to invite new users to the chat
pub can_invite_users: bool,
/// *True*, if the user is allowed to pin messages
pub can_pin_messages: bool,
/// *True*, if the user is allowed to create forum topics
pub can_manage_topics: bool,
/// Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever
pub until_date: i64,
}
// Divider: all content below this line will be preserved after code regen
use super::chat_permissions::ChatPermissions;
impl ChatMemberRestricted {
pub const fn permissions(&self) -> ChatPermissions {
ChatPermissions {
can_send_messages: self.can_send_messages,
can_send_audios: self.can_send_audios,
can_send_documents: self.can_send_documents,
can_send_photos: self.can_send_photos,
can_send_videos: self.can_send_videos,
can_send_video_notes: self.can_send_video_notes,
can_send_voice_notes: self.can_send_voice_notes,
can_send_polls: self.can_send_polls,
can_send_other_messages: self.can_send_other_messages,
can_add_web_page_previews: self.can_add_web_page_previews,
can_change_info: self.can_change_info,
can_invite_users: self.can_invite_users,
can_pin_messages: self.can_pin_messages,
can_manage_topics: self.can_manage_topics,
}
}
}