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
97
98
99
100
101
102
103
104
105
106
107
mod embed;
mod message;
mod overwrite;
pub use embed::{Embed, EmbedAuthor, EmbedField, EmbedFooter, EmbedImage, EmbedProvider, EmbedThumbnail, EmbedVideo};
pub use message::Message;
pub use overwrite::Overwrite;
use crate::models::user::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Channel {
id: String,
#[serde(rename = "type")]
kind: u64,
guild_id: Option<String>,
position: Option<u64>,
name: Option<String>,
topic: Option<String>,
nsfw: Option<bool>,
last_message_id: Option<String>,
bitrate: Option<u64>,
user_limit: Option<u64>,
rate_limit_per_user: Option<u64>,
recipients: Option<Vec<User>>,
icon: Option<String>,
owner_id: Option<String>,
application_id: Option<String>,
parent_id: Option<String>,
last_pin_timestamp: Option<String>,
}
impl Channel {
pub fn id(&self) -> &str {
&self.id
}
pub fn kind(&self) -> u64 {
self.kind
}
pub fn guild_id(&self) -> Option<&str> {
self.guild_id.as_ref().map(|s| s.as_str())
}
pub fn position(&self) -> Option<u64> {
self.position
}
pub fn name(&self) -> Option<&str> {
self.name.as_ref().map(|s| s.as_str())
}
pub fn topic(&self) -> Option<&str> {
self.topic.as_ref().map(|s| s.as_str())
}
pub fn is_nsfw(&self) -> Option<bool> {
self.nsfw
}
pub fn last_message_id(&self) -> Option<&str> {
self.last_message_id.as_ref().map(|s| s.as_str())
}
pub fn recipients(&self) -> Option<&[User]> {
self.recipients.as_ref().map(|s| s.as_slice())
}
pub fn icon(&self) -> Option<&str> {
self.icon.as_ref().map(|s| s.as_str())
}
pub fn owner_id(&self) -> Option<&str> {
self.owner_id.as_ref().map(|s| s.as_str())
}
pub fn application_id(&self) -> Option<&str> {
self.application_id.as_ref().map(|s| s.as_str())
}
pub fn parent_id(&self) -> Option<&str> {
self.parent_id.as_ref().map(|s| s.as_str())
}
pub fn last_pin_timestamp(&self) -> Option<&str> {
self.last_pin_timestamp.as_ref().map(|s| s.as_str())
}
}