Skip to content

Commit

Permalink
don't emit *events.GuildJoin on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Sep 26, 2024
1 parent 71cd4c8 commit e8ae7a3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions handlers/guild_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func gatewayHandlerGuildCreate(client bot.Client, sequenceNumber int, shardID in
}()
}

return
}
if wasUnavailable {
client.Caches().SetGuildUnavailable(event.ID, false)
Expand Down Expand Up @@ -118,6 +119,10 @@ func gatewayHandlerGuildUpdate(client bot.Client, sequenceNumber int, shardID in
}

func gatewayHandlerGuildDelete(client bot.Client, sequenceNumber int, shardID int, event gateway.EventGuildDelete) {
if event.Unavailable {
client.Caches().SetGuildUnavailable(event.ID, true)
}

guild, _ := client.Caches().RemoveGuild(event.ID)
client.Caches().RemoveVoiceStatesByGuildID(event.ID)
client.Caches().RemovePresencesByGuildID(event.ID)
Expand All @@ -137,10 +142,6 @@ func gatewayHandlerGuildDelete(client bot.Client, sequenceNumber int, shardID in
client.Caches().RemoveGuildSoundboardSoundsByGuildID(event.ID)
client.Caches().RemoveMessagesByGuildID(event.ID)

if event.Unavailable {
client.Caches().SetGuildUnavailable(event.ID, true)
}

genericGuildEvent := &events.GenericGuild{
GenericEvent: events.NewGenericEvent(client, sequenceNumber, shardID),
GuildID: event.ID,
Expand Down

0 comments on commit e8ae7a3

Please sign in to comment.