forked from discord/hal-9000
26 lines
1005 B
Rust
26 lines
1005 B
Rust
|
|
mod events;
|
||
|
|
mod commands;
|
||
|
|
|
||
|
|
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;
|
||
|
|
}
|