2020-10-15 16:52:08 +00:00
|
|
|
use chronicle_dicebot::commands::Command;
|
|
|
|
use chronicle_dicebot::context::Context;
|
|
|
|
use chronicle_dicebot::db::Database;
|
|
|
|
use chronicle_dicebot::error::BotError;
|
2020-04-21 03:15:13 +00:00
|
|
|
|
2020-10-15 16:52:08 +00:00
|
|
|
fn main() -> Result<(), BotError> {
|
|
|
|
let db = Database::new(&sled::open("test-db")?);
|
|
|
|
let input = std::env::args().skip(1).collect::<Vec<String>>().join(" ");
|
|
|
|
let command = match Command::parse(&input) {
|
|
|
|
Ok(command) => command,
|
|
|
|
Err(e) => return Err(e),
|
2020-04-21 03:15:13 +00:00
|
|
|
};
|
2020-10-15 16:52:08 +00:00
|
|
|
|
|
|
|
let context = Context::new(&db, "roomid", "localuser", &input);
|
|
|
|
println!("{}", command.execute(&context).plain());
|
2020-04-21 03:15:13 +00:00
|
|
|
Ok(())
|
|
|
|
}
|