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
use twilight_model::{
guild::Emoji,
id::{
marker::{EmojiMarker, GuildMarker, UserMarker},
Id,
},
};
#[derive(Clone, Debug)]
#[cfg_attr(feature = "tests", derive(PartialEq, Eq))]
pub struct CachedEmoji {
pub guild_id: Id<GuildMarker>,
pub animated: bool,
pub available: bool,
pub id: Id<EmojiMarker>,
pub managed: bool,
pub name: String,
pub require_colons: bool,
pub user: Option<Id<UserMarker>>,
}
impl CachedEmoji {
#[must_use]
pub fn from_emoji(emoji: &Emoji, guild_id: Id<GuildMarker>) -> Self {
Self {
guild_id,
animated: emoji.animated,
available: emoji.available,
id: emoji.id,
managed: emoji.managed,
name: emoji.name.clone(),
require_colons: emoji.require_colons,
user: emoji.user.as_ref().map(|user| user.id),
}
}
}