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
use super::*;
#[derive(Debug, PartialEq, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ClearChat {
pub(super) tags: Tags,
pub(super) channel: Channel,
pub(super) user: Option<String>,
}
impl ClearChat {
pub fn tags(&self) -> &Tags {
&self.tags
}
pub fn user(&self) -> Option<&str> {
self.user.as_ref().map(String::as_str)
}
pub fn channel(&self) -> &Channel {
&self.channel
}
}
impl ClearChat {
pub fn ban_duration(&self) -> Option<u64> {
self.get("ban-duration")?.parse().ok()
}
}
impl Tag for ClearChat {
fn get(&self, key: &str) -> Option<&str> {
self.tags.get(key).map(AsRef::as_ref)
}
}