feat(events/bot): adding a ready files

This commit is contained in:
Raphael 2026-02-12 16:19:26 +01:00
parent a55e9f9ce6
commit 94f2ac047b
No known key found for this signature in database

18
src/events/bot/ready.rs Normal file
View 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());
}