2025-05-02 22:35:33 +00:00
mod events ;
mod commands ;
2025-05-04 15:47:43 +00:00
mod models ;
mod schema ;
2025-05-02 22:35:33 +00:00
use clap ::ArgMatches ;
use poise ::serenity_prelude ::GatewayIntents ;
use crate ::built_info ;
use diesel_migrations ::{ embed_migrations , EmbeddedMigrations } ;
use crate ::hal ::events ::HalHandler ;
pub const MIGRATIONS : EmbeddedMigrations = embed_migrations! ( " migrations " ) ;
#[ tokio::main ]
pub async fn run ( arguments : ArgMatches ) {
let git_info : String = built_info ::GIT_VERSION . unwrap_or ( " unknown " ) . to_string ( ) ;
let version_string = format! ( " Hal 9000 Bot version {ver} built at {time} from revision {rev} " , ver = built_info ::PKG_VERSION , time = built_info ::BUILT_TIME_UTC , rev = git_info ) . to_string ( ) ;
let client = match manifold ::prepare_client ::< HalHandler > ( arguments , GatewayIntents ::all ( ) , commands ::collect_commands ( ) , version_string , MIGRATIONS ) . await {
Ok ( c ) = > c ,
Err ( e ) = > {
error! ( " Error preparing client; {:?} " , e ) ;
panic! ( " Error preparing client! " ) ;
}
} ;
let _ = client . build ( ) . await . unwrap ( ) . start ( ) . await ;
}