MCPcopy Create free account
hub / github.com/Botloader/botloader / from_cache

Method from_cache

components/runtime-models/src/internal/member.rs:93–115  ·  view source on GitHub ↗
(user: User, member: twilight_cache_inmemory::model::CachedMember)

Source from the content-addressed store, hash-verified

91
92impl Member {
93 pub fn from_cache(user: User, member: twilight_cache_inmemory::model::CachedMember) -> Self {
94 Self {
95 user,
96 deaf: member.deaf().unwrap_or_default(),
97 joined_at: NotBigU64(
98 member
99 .joined_at()
100 .unwrap_or(Timestamp::from_micros(0).unwrap())
101 .as_micros() as u64
102 / 1000,
103 ),
104 mute: member.mute().unwrap_or_default(),
105 nick: member.nick().map(ToString::to_string),
106 premium_since: member
107 .premium_since()
108 .map(|v| NotBigU64(v.as_micros() as u64 / 1000)),
109 roles: member.roles().iter().map(ToString::to_string).collect(),
110 communication_disabled_until: member
111 .communication_disabled_until()
112 .map(|ts| NotBigU64(ts.as_micros() as u64 / 1000)),
113 pending: false,
114 }
115 }
116
117 pub fn from_partial(partial: twilight_model::guild::PartialMember) -> Self {
118 Self {

Callers

nothing calls this directly

Calls 1

NotBigU64Class · 0.85

Tested by

no test coverage detected