badgey/src/main.rs

48 lines
1.6 KiB
Rust

#![feature(string_remove_matches)]
#[macro_use] extern crate diesel;
#[macro_use] extern crate diesel_migrations;
#[macro_use] extern crate log;
pub mod badgey;
use clap::{Command, Arg, crate_version};
// Retrieve build info from output file
pub mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}
fn main() {
env_logger::init();
let git_info: String = built_info::GIT_VERSION.unwrap_or("unknown").to_string();
info!("Badgey Bot version {}({}) starting up...", built_info::PKG_VERSION, git_info);
let matches = Command::new("Badgey Bot, Discord Edition")
.version(crate_version!())
.author("Xyon <xyon@orbiter-radio.uk>")
.about("General-Purpose bot for the Escape Pod 14 Discord Server.")
.arg(Arg::new("config-file")
.short('c')
.long("config-file")
.value_name("FILE")
.default_value("badgey.json")
.help("Path to the config file to use, relative to the 'config/' subdirectory beneath the binary path. Defaults to config/badgey.json."))
.arg(Arg::new("environment")
.short('e')
.long("environment")
.value_name("ENV")
.default_value("Production")
.help("Bot environment to use. Determines which config settings are read. Defaults to Production."))
.arg(Arg::new("make-config")
.short('M')
.long("make-config")
.help("Generates a default config file, to get started. This will be just enough for the bot to run, but some key settings will be incorrect."))
.get_matches();
badgey::run(matches);
}