Skip to content

Commit

Permalink
fix: no need for a set of keys
Browse files Browse the repository at this point in the history
  • Loading branch information
bitomic authored and favna committed Dec 11, 2022
1 parent a1fea5e commit 00dfb8c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/optional-listeners/unknown-commands/CoreReady.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export class CoreEvent extends Listener {
}

public async run() {
const clientCommands = await this.container.client.application?.commands.fetch();
if (!clientCommands) return;
const storedCommands = new Set(this.container.stores.get('commands').keys());
const commandsToDelete = clientCommands.filter((command) => !storedCommands.has(command.name));
const commands = await this.container.client.application?.commands.fetch();
const store = this.container.stores.get('commands');
if (!commands) return;
const commandsToDelete = commands.filter((command) => !store.has(command.name));

for (const command of commandsToDelete.values()) {
await this.container.client.application?.commands.delete(command);
Expand Down

0 comments on commit 00dfb8c

Please sign in to comment.