Declare create and delete commands for tags
This commit is contained in:
parent
1e35753d1f
commit
2146b50ab6
|
@ -17,29 +17,34 @@ impl EventHandler for Handler {
|
|||
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||
println!("Successfully connected as {}", ready.user.name);
|
||||
|
||||
let _ = Command::create_global_application_command(&ctx.http, |command| {
|
||||
match Command::create_global_application_command(&ctx.http, |command| {
|
||||
command
|
||||
.name("tag new")
|
||||
.name("create_tag")
|
||||
.description("Add a new tag")
|
||||
.create_option(|option| {
|
||||
option
|
||||
.name("new_tag")
|
||||
.description("The new tag to add")
|
||||
.name("tag")
|
||||
.description("The tag to create")
|
||||
.kind(CommandOptionType::String)
|
||||
.required(true)
|
||||
})
|
||||
})
|
||||
.await;
|
||||
.await
|
||||
{
|
||||
Ok(_) => println!("Successfully registered create_tag command"),
|
||||
Err(e) => println!("Failed to register create_tag command : {e}"),
|
||||
};
|
||||
|
||||
let _ = Command::create_global_application_command(&ctx.http, |command| {
|
||||
match Command::create_global_application_command(&ctx.http, |command| {
|
||||
let command = command
|
||||
.name("tag bulk_new")
|
||||
.name("bulk_create_tag")
|
||||
.description("Add multiples tags");
|
||||
|
||||
for i in 0..MAX_ARGS_NUMBER {
|
||||
command.create_option(|option| {
|
||||
option
|
||||
.name("new_tag_{i+1}")
|
||||
.name(format!("tag{}", i + 1))
|
||||
.description("A new tag to add")
|
||||
.kind(CommandOptionType::String)
|
||||
.required(i == 0)
|
||||
});
|
||||
|
@ -47,19 +52,29 @@ impl EventHandler for Handler {
|
|||
|
||||
command
|
||||
})
|
||||
.await;
|
||||
.await
|
||||
{
|
||||
Ok(_) => println!("Successfully registered bulk_create_tag command"),
|
||||
Err(e) => println!("Failed to register bulk_create_tag command: {e}"),
|
||||
};
|
||||
|
||||
let _ = Command::create_global_application_command(&ctx.http, |command| {
|
||||
match Command::create_global_application_command(&ctx.http, |command| {
|
||||
command
|
||||
.name("tag delete")
|
||||
.name("delete_tag")
|
||||
.description("Delete a tag")
|
||||
.create_option(|option| {
|
||||
option
|
||||
.name("tag")
|
||||
.description("The tag to delete")
|
||||
.kind(CommandOptionType::String)
|
||||
.required(true)
|
||||
})
|
||||
});
|
||||
})
|
||||
.await
|
||||
{
|
||||
Ok(_) => println!("Successfully registered delete_tag command"),
|
||||
Err(e) => println!("Failed to register delete_tag command: {e}"),
|
||||
};
|
||||
}
|
||||
|
||||
async fn resume(&self, _: Context, _: ResumedEvent) {
|
||||
|
|
Loading…
Reference in a new issue