Made main function async

main
David 2022-12-30 10:50:26 +01:00
parent ab7f75b416
commit 2af8142e54
2 changed files with 10 additions and 4 deletions

View File

@ -9,8 +9,11 @@ The bot is orientated towards admins of large Matrix rooms that are public and r
## How to run?
**Using Docker:**
docker run -v /local/path/to/config.int:/config.ini -t matrix-modbot:latest
A minimal Docker image containing the compiled binary is published on [Docker Hub](https://hub.docker.com/r/davidlocalhost/matrix-modbot"). Note that this image is automatically pushed using a CI/CD Pipeline for every commit made to the main branch. Expect there to be bugs and breaking changes.
`sudo docker run -v /local/path/to/config.ini:/config.ini -t matrix-modbot:latest`
**Using Cargo:**
cargo build --release
cargo run
```
cargo build --release
cargo run /path/to/config.ini
```

View File

@ -11,10 +11,13 @@ pub use utils::utils::*;
async fn main() {
println!("Starting Matrix-Modbot");
let mut args: Vec<String> = env::args().collect();
if args.len() > 1 {
panic!("Please only pass in 1 argument!");
}
if args.is_empty() {
args.push("config.ini".to_string()) // Set the default config file path to config.ini
}
let config_path = &args[0];
let creds = BotUserInfo::get_info(config_path).unwrap();
Bot::bot_login(creds);
Bot::bot_login(creds).await;
}