Prettified Code!

This commit is contained in:
itohatweb
2021-05-21 15:51:33 +00:00
committed by GitHub Action
parent fe4ab8517b
commit 3549cdeb63
279 changed files with 1617 additions and 1768 deletions
+10 -11
View File
@@ -11,15 +11,12 @@ export async function handleVoiceStateUpdate(data: DiscordGatewayPayload) {
const guild = await cacheHandlers.get(
"guilds",
snowflakeToBigint(payload.guildId),
snowflakeToBigint(payload.guildId)
);
if (!guild) return;
const member = payload.member
? await structures.createDiscordenoMember(
payload.member,
guild.id,
)
? await structures.createDiscordenoMember(payload.member, guild.id)
: await cacheHandlers.get("members", snowflakeToBigint(payload.userId));
if (!member) return;
@@ -28,27 +25,29 @@ export async function handleVoiceStateUpdate(data: DiscordGatewayPayload) {
guild.voiceStates.set(
snowflakeToBigint(payload.userId),
await structures.createDiscordenoVoiceState(guild.id, payload),
await structures.createDiscordenoVoiceState(guild.id, payload)
);
await cacheHandlers.set("guilds", guild.id, guild);
if (
cachedState?.channelId !==
(payload.channelId ? snowflakeToBigint(payload.channelId) : null)
(payload.channelId ? snowflakeToBigint(payload.channelId) : null)
) {
// Either joined or moved channels
if (payload.channelId) {
if (cachedState?.channelId) { // Was in a channel before
if (cachedState?.channelId) {
// Was in a channel before
eventHandlers.voiceChannelSwitch?.(
member,
snowflakeToBigint(payload.channelId),
cachedState.channelId,
cachedState.channelId
);
} else { // Was not in a channel before so user just joined
} else {
// Was not in a channel before so user just joined
eventHandlers.voiceChannelJoin?.(
member,
snowflakeToBigint(payload.channelId),
snowflakeToBigint(payload.channelId)
);
}
} // Left the channel