Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: optionally remove commands that are in the application but not in the commands store #579

Closed
wants to merge 8 commits into from

Conversation

bitomic
Copy link
Contributor

@bitomic bitomic commented Dec 11, 2022

closes #577

  • Adds an optional client property automaticallyDeleteUnknownCommands.
  • When automaticallyDeleteUnknownCommands is set to true, it loads an optional listener on the ready event that runs once. Gets what application commands are in client.application.commands and filters the names that aren't in container.stores.get('commands').keys().

Before merging:

  • It assumes the command's [internal] name is the same as the piece's name. This should always be correct, right?
  • If I understand correctly, it will remove not only chat input commands but also the other kinds. Should this be intended? (I assume yes)

Copy link
Member

@favna favna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add some logging to this file. Start with adding the following then follow other suggestions for log lines.

	private debug(message: string, ...other: unknown[]) {
		container.logger.debug(`UnknownApplicationCommandDeletion ${message}`, ...other);
	}

@favna
Copy link
Member

favna commented Dec 14, 2022

@vladfrangu review pls

@vladfrangu
Copy link
Member

This is not how it should be done. This should be a mode which decides if the registries use commands.set instead of commands.create/commands.delete! It also completely ignores the registries, or the ids/names they have inside.

@favna
Copy link
Member

favna commented Dec 17, 2022

I actually have no idea what you're referring to and if I don't then @bitomic probably definitely doesn't either. I rather have a feeling that you're missing the point of this option. The point is that every command that doesn't have a matching piece is nuked. And if people using it do not use this.name for setName then that's on them, that is covered in the JSDoc as well.

@favna
Copy link
Member

favna commented Dec 31, 2022

@vladfrangu has veto'd that #577 won't be realized (at least at the current time) in favour of #578. So I'm keeping this PR open for now until @vladfrangu finishes his changes, but don't expect this to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

request: [CoreReady listener] automatically delete application commands not found in the Command store
3 participants