diff options
| author | Arne Dußin | 2021-07-31 11:51:25 +0200 |
|---|---|---|
| committer | Arne Dußin | 2021-07-31 11:51:25 +0200 |
| commit | 2f14f7edf29bd7010e5f8be8691a907c8ede1278 (patch) | |
| tree | 2708ee050e3dba8ca75be2160428e1c4bd487367 /src/main.rs | |
| parent | af7514d42b3ec6743fd8037c6e909ae8134dfa4f (diff) | |
| download | matrix-zizek-bot-2f14f7edf29bd7010e5f8be8691a907c8ede1278.tar.gz matrix-zizek-bot-2f14f7edf29bd7010e5f8be8691a907c8ede1278.zip | |
First basic testing zizek bot
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(), + ); } |
