Improve command registration
This commit is contained in:
parent
d54b600391
commit
8ffea41db0
|
@ -38,6 +38,7 @@ async fn register(
|
|||
ctx: Context<'_>,
|
||||
#[flag] global: bool,
|
||||
#[flag] purge: bool,
|
||||
#[flag] not: bool,
|
||||
#[rest] rest: String,
|
||||
) -> Result<(), Error> {
|
||||
// poise::builtins::register_application_commands(ctx, global).await?;
|
||||
|
@ -47,8 +48,8 @@ async fn register(
|
|||
ctx.say(format!("Commands: {}", commands.len())).await?;
|
||||
let mut command_count: u8 = 0;
|
||||
for command in commands {
|
||||
command_count += 1;
|
||||
if rest.eq_ignore_ascii_case("all") || rest.contains(&command.name) {
|
||||
if rest.eq_ignore_ascii_case("all") || (rest.contains(&command.name) ^ not) {
|
||||
command_count += 1;
|
||||
if let Some(slash_command) = command.create_as_slash_command() {
|
||||
commands_builder.add_application_command(slash_command);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue