assistant: Put /docs
and /project
behind a setting (#16186)
This PR puts the availability of the `/docs` and `/project` slash commands behind their respective settings. Release Notes: - N/A
This commit is contained in:
parent
c3edbd7d9a
commit
47628515e1
5 changed files with 91 additions and 16 deletions
|
@ -56,6 +56,14 @@ impl SlashCommandRegistry {
|
|||
state.commands.insert(command_name, Arc::new(command));
|
||||
}
|
||||
|
||||
/// Unregisters the provided [`SlashCommand`].
|
||||
pub fn unregister_command(&self, command: impl SlashCommand) {
|
||||
let mut state = self.state.write();
|
||||
let command_name: Arc<str> = command.name().into();
|
||||
state.featured_commands.remove(&command_name);
|
||||
state.commands.remove(&command_name);
|
||||
}
|
||||
|
||||
/// Returns the names of registered [`SlashCommand`]s.
|
||||
pub fn command_names(&self) -> Vec<Arc<str>> {
|
||||
self.state.read().commands.keys().cloned().collect()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue