From b87421f0fbd3461d5e9f43672c27618c037209d0 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 30 Jun 2023 22:20:32 +0300 Subject: [PATCH] Ignore guild delete events with unavailable=true --- user.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user.go b/user.go index 9890184..8d9c0e8 100644 --- a/user.go +++ b/user.go @@ -1024,6 +1024,10 @@ func (user *User) guildCreateHandler(g *discordgo.GuildCreate) { } func (user *User) guildDeleteHandler(g *discordgo.GuildDelete) { + if g.Unavailable { + user.log.Info().Str("guild_id", g.ID).Msg("Ignoring guild delete event with unavailable flag") + return + } user.log.Info().Str("guild_id", g.ID).Msg("Got guild delete event") user.MarkNotInPortal(g.ID) guild := user.bridge.GetGuildByID(g.ID, false)