feat: added command to add the details to teh bot for a server

This commit is contained in:
silver 2023-09-17 19:30:59 +01:00
parent fa6920e4a3
commit 83aee45d7b
4 changed files with 160 additions and 3 deletions

View file

@ -55,13 +55,19 @@ impl EventHandler for Handler {
async fn ready(&self, ctx: Context, ready: Ready) {
println!("[Main] {} is connected!", ready.user.name);
Command::set_global_application_commands(&ctx.http, |commands| {
match Command::set_global_application_commands(&ctx.http, |commands| {
commands
.create_application_command(|command| commands::add_server::register(command))
.create_application_command(|command| commands::link_email::link::register(command))
.create_application_command(|command| commands::link_email::verify::register(command))
})
.await
.ok();
{
Ok(_) => {}
Err(e) => {
println!("{:?}", e)
}
}
}
async fn interaction_create(&self, ctx: Context, interaction: Interaction) {
@ -70,6 +76,7 @@ impl EventHandler for Handler {
//println!("Received command interaction: {:#?}", command);
let content = match command.data.name.as_str() {
"add" => commands::add_server::run(&command, &ctx).await,
"link" => commands::link_email::link::run(&command, &ctx).await,
"verify" => commands::link_email::verify::run(&command, &ctx).await,
_ => "not implemented :(".to_string(),