use twilight_model::application::command::Command;
use crate::commands;
use crate::events::{EventContext, Ready};
use crate::state::StateBound;
pub async fn register<State>(ctx: EventContext<State, Ready>)
where
State: StateBound,
{
let client = ctx.handle.client.interaction(ctx.event.application.id);
let mut to_register: Vec<Command> = vec![];
for command in commands::flatten_slash(&ctx.handle.commands)
.into_iter()
.cloned()
{
to_register.push(command.into());
}
for command in commands::flatten_message(&ctx.handle.commands)
.into_iter()
.cloned()
{
to_register.push(command.into());
}
client.set_global_commands(&to_register).await.unwrap();
}