diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index e7a11a9..a3b1f64 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,35 @@ -fn main() { - println!("Hello, world!"); +#![warn(missing_docs)] + +//! In case you and your friends ever felt like you don't have enough +//! Slavoj Žižek in your life, this matrix bot can help you satisfying that +//! need. + +use std::sync::{Arc, Mutex}; + +use matrix_bot_api::MatrixBot; + +pub mod bot_config; +pub mod command_handler; +pub mod zizek_db; + +use bot_config::BotConfig; +use command_handler::CommandHandler; +use zizek_db::ZizekDb; + +fn main() +{ + let bot_config = BotConfig::from_config_file().expect("Unable to read bot configuration file"); + let zizek_db = Arc::new(Mutex::new( + ZizekDb::from_file("zizek_quotes.db").expect("Unable to load zizek quote database"), + )); + + /* The command handler is the handler with the highest priority, so it gets + * registered first */ + let bot = MatrixBot::new(CommandHandler::new(zizek_db.clone())); + + bot.run( + bot_config.user(), + bot_config.password(), + bot_config.homeserver_url(), + ); } |
