✨ Purge configuration data of removed guilds #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When Needle is removed from a guild (kicked, guild deleted, etc.), it will now delete the configuration data of that guild.
On startup, Needle will compare the configs directory to its current guilds, deleting ones it's no longer in. This is done in case Needle is offline when the
guildDelete
event fires. As a precautionary measure, Needle will not delete configs if no guilds are present; this protects against the wrong token being used by mistake, or a theoretical Discord API error.Both of these things are achieved through the
resetConfigToDefault
function, which just deletes the respective file.