Skip to content

fix: Prevent Guild Cache Error Being Called for Current User

Mateusz Brawański requested to merge patch/current-user-member-remove into master

Created by: Neuheit

Summary

Ensures that the appropriate events are handled correctly when the current user leaves a guild.

Details

When the bot leaves a guild, other events such as guild integrations update and guild member removed are fired either before or after guild deleted. This can lead to inconsistent state where the guild is already removed from the internal cache but the other events that rely on the guild from the cache are fired afterwards, leading to some socket errors. This PR solves this issue by ignoring the guild integrations update event if the guild is not found and also won't display the log error message

Changes proposed

  • Ignore the guild integration update event if the guild can't be retrieved from cache
  • Don't display the guild cache error message if it's the current user that left.

Merge request reports

Loading