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

Method from_partial

components/runtime-models/src/internal/member.rs:117–142  ·  view source on GitHub ↗
(partial: twilight_model::guild::PartialMember)

Source from the content-addressed store, hash-verified

115 }
116
117 pub fn from_partial(partial: twilight_model::guild::PartialMember) -> Self {
118 Self {
119 joined_at: NotBigU64(
120 partial
121 .joined_at
122 .unwrap_or(Timestamp::from_micros(0).unwrap())
123 .as_micros() as u64
124 / 1000,
125 ),
126 nick: partial.nick,
127 premium_since: partial
128 .premium_since
129 .map(|ts| NotBigU64(ts.as_micros() as u64 / 1000)),
130 roles: partial.roles.iter().map(ToString::to_string).collect(),
131 communication_disabled_until: partial
132 .communication_disabled_until
133 .map(|ts| NotBigU64(ts.as_micros() as u64 / 1000)),
134 user: partial.user.unwrap().into(),
135 deaf: partial.deaf,
136 mute: partial.mute,
137 // From what i can see in the docs, pending is only omitted in events where it's always false, as they
138 // can't be pending to trigger that event
139 // so this should be sufficient for now.
140 pending: false,
141 }
142 }
143}
144
145impl From<twilight_model::gateway::payload::incoming::MemberUpdate> for Member {

Callers

nothing calls this directly

Calls 1

NotBigU64Class · 0.85

Tested by

no test coverage detected