26 lines
961 B
Rust
26 lines
961 B
Rust
use serenity::model::interactions::application_command::ApplicationCommand;
|
|
use serenity::prelude::*;
|
|
|
|
use commands::{BotCommand, CommandError};
|
|
use commands::add_item::AddItemCommand;
|
|
use commands::add_location::AddLocationCommand;
|
|
use commands::find::FindCommand;
|
|
use commands::selling::SellingCommand;
|
|
|
|
pub mod commands;
|
|
|
|
pub async fn create_commands(ctx: &Context) -> Result<Vec<ApplicationCommand>, CommandError> {
|
|
let mut commands: Vec<ApplicationCommand> = Vec::new();
|
|
|
|
for command in ApplicationCommand::get_global_application_commands(&ctx.http).await? {
|
|
ApplicationCommand::delete_global_application_command(&ctx.http, command.id).await?;
|
|
}
|
|
|
|
commands.push(FindCommand::create_app_command(ctx).await?);
|
|
commands.push(SellingCommand::create_app_command(ctx).await?);
|
|
commands.push(AddLocationCommand::create_app_command(ctx).await?);
|
|
commands.push(AddItemCommand::create_app_command(ctx).await?);
|
|
|
|
Ok(commands)
|
|
}
|