feat(events/bot): adding a ready files
This commit is contained in:
parent
a55e9f9ce6
commit
94f2ac047b
1 changed files with 18 additions and 0 deletions
18
src/events/bot/ready.rs
Normal file
18
src/events/bot/ready.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use serenity::all::*;
|
||||
use crate::commands::SlashCommand;
|
||||
|
||||
pub async fn handle(ctx: &Context, ready: &Ready, commands: &[Box<dyn SlashCommand>]) {
|
||||
println!("TTY is now running as: '{}'\n", ready.user.name);
|
||||
|
||||
println!("Starting command registration:");
|
||||
let cmds: Vec<CreateCommand> = commands
|
||||
.iter()
|
||||
.map(|c| c.register())
|
||||
.collect();
|
||||
|
||||
Command::set_global_commands(&ctx.http, cmds)
|
||||
.await
|
||||
.expect("❌ | Cannot register commands");
|
||||
|
||||
println!("\nTTY now running with {} commands loaded", commands.len());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue