mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
feat: only require one guild delete event (#3194)
This commit is contained in:
@@ -2,14 +2,14 @@ import type { DiscordGatewayPayload, DiscordUnavailableGuild } from '@discordeno
|
||||
import type { Bot } from '../../bot.js'
|
||||
|
||||
export async function handleGuildDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number): Promise<void> {
|
||||
if (!bot.events.guildDelete || !bot.events.guildUnavailable) return
|
||||
|
||||
const payload = data.d as DiscordUnavailableGuild
|
||||
|
||||
if (payload.unavailable) {
|
||||
if (bot.events.guildUnavailable && payload.unavailable) {
|
||||
bot.events.guildUnavailable(bot.transformers.snowflake(payload.id), shardId)
|
||||
return
|
||||
}
|
||||
|
||||
bot.events.guildDelete(bot.transformers.snowflake(payload.id), shardId)
|
||||
if (bot.events.guildDelete) {
|
||||
bot.events.guildDelete(bot.transformers.snowflake(payload.id), shardId)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user