fix: channels, presences, voiceStates can be undef (#301)

* fix(Guild): presences and voiceStates can be undef

* fix: handle undef Guild#voiceStates

* fix: channels, presences, voice_states can be undef

* Revert "fix: handle undef Guild#voiceStates"

This reverts commit ddd3c32e21.
This commit is contained in:
Ayyan
2020-12-31 19:52:07 +04:00
committed by GitHub
parent 6e1afa13a4
commit 8c9a075d30
+4 -3
View File
@@ -137,9 +137,10 @@ export async function createGuild(data: CreateGuildPayload, shardID: number) {
preferred_locale: preferredLocale,
joined_at: joinedAt,
member_count: memberCount,
voice_states: voiceStates,
channels,
voice_states: voiceStates = [],
channels = [],
members,
presences = [],
...rest
} = data;
@@ -186,7 +187,7 @@ export async function createGuild(data: CreateGuildPayload, shardID: number) {
roles: createNewProp(new Collection(roles.map((r: Role) => [r.id, r]))),
joinedAt: createNewProp(Date.parse(joinedAt)),
presences: createNewProp(
new Collection(data.presences.map((p: Presence) => [p.user.id, p])),
new Collection(presences.map((p: Presence) => [p.user.id, p])),
),
memberCount: createNewProp(memberCount || 0),
voiceStates: createNewProp(