tty/src/events/bot/ready.rs
Raphael 4f5b0fd5ea
refactor(events/bot): adding a backline before the last message
The last message refere to the last message sent by TTY when running
2026-02-12 23:19:25 +01:00

25 lines
784 B
Rust

use serenity::all::*;
use crate::commands::SlashCommand;
use crate::events::{BotEvent, EventEntry};
pub struct ReadyHandler;
#[serenity::async_trait]
impl BotEvent for ReadyHandler {
fn event_type(&self) -> &'static str { "ready" }
async fn on_ready(&self, ctx: &Context, ready: &Ready, commands: &[Box<dyn SlashCommand>]) {
println!("TTY is now running as: '{}'", ready.user.name);
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());
}
}
inventory::submit! {
EventEntry { create: || Box::new(ReadyHandler) }
}