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
use serde::Serialize;
use twilight_model::{
id::{
marker::{ChannelMarker, GuildMarker, UserMarker},
Id,
},
voice::VoiceState,
};
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct CachedVoiceState {
channel_id: Option<Id<ChannelMarker>>,
deaf: bool,
guild_id: Option<Id<GuildMarker>>,
mute: bool,
self_deaf: bool,
self_mute: bool,
self_stream: bool,
session_id: String,
suppress: bool,
token: Option<String>,
user_id: Id<UserMarker>,
}
impl CachedVoiceState {
pub const fn channel_id(&self) -> Option<Id<ChannelMarker>> {
self.channel_id
}
pub const fn deaf(&self) -> bool {
self.deaf
}
pub const fn guild_id(&self) -> Option<Id<GuildMarker>> {
self.guild_id
}
pub const fn mute(&self) -> bool {
self.mute
}
pub const fn self_deaf(&self) -> bool {
self.self_deaf
}
pub const fn self_mute(&self) -> bool {
self.self_mute
}
pub const fn self_stream(&self) -> bool {
self.self_stream
}
pub fn session_id(&self) -> &str {
&self.session_id
}
pub const fn suppress(&self) -> bool {
self.suppress
}
pub fn token(&self) -> Option<&str> {
self.token.as_deref()
}
pub const fn user_id(&self) -> Id<UserMarker> {
self.user_id
}
}
impl PartialEq<VoiceState> for CachedVoiceState {
fn eq(&self, other: &VoiceState) -> bool {
self.channel_id == other.channel_id
&& self.deaf == other.deaf
&& self.guild_id == other.guild_id
&& self.mute == other.mute
&& self.self_deaf == other.self_deaf
&& self.self_mute == other.self_mute
&& self.self_stream == other.self_stream
&& self.session_id == other.session_id
&& self.suppress == other.suppress
&& self.token == other.token
&& self.user_id == other.user_id
}
}