This pull request aims to refactor and optimize the code responsible for handling the removal of a bot from a Discord server. The original code contained redundant and repetitive lines for deleting entries from various database schemas associated with a guild. The updated code introduces a more concise and maintainable approach.
Changes Made:
Consolidation of Schemas:
Instead of individually importing and deleting entries for each database schema, an array (schemaFiles) has been created to store the names of all schemas.
A loop now dynamically imports each schema, reducing redundancy in the code.
Simplified Database Cleanup:
The deleteMany operation for each schema is now performed within a loop, eliminating repetitive lines.
The loop iterates over the imported schemas, and each schema's deleteMany operation targets entries with the specified Guild.
This pull request aims to refactor and optimize the code responsible for handling the removal of a bot from a Discord server. The original code contained redundant and repetitive lines for deleting entries from various database schemas associated with a guild. The updated code introduces a more concise and maintainable approach.
Changes Made:
Consolidation of Schemas:
schemaFiles
) has been created to store the names of all schemas.Simplified Database Cleanup:
deleteMany
operation for each schema is now performed within a loop, eliminating repetitive lines.deleteMany
operation targets entries with the specifiedGuild
.