Make bot use a config.toml

This commit is contained in:
Yash Karandikar 2021-07-15 14:23:12 -05:00
parent 9ecfa6765e
commit f7e672890b
Signed by: karx
GPG key ID: A794DA2529474BA5

View file

@ -8,17 +8,8 @@ use htmlescape::decode_html;
#[tokio::main]
async fn main() -> Result<(), failure::Error> {
println!("TitleBot v2.0 by karx");
let config = Config {
nickname: Some("titlebot".to_owned()),
umodes: Some("+B".to_owned()),
server: Some("192.168.254.28".to_owned()),
channels: vec!["#no-normies".to_owned(), "#main".to_owned(), "#aksmp".to_owned(), "#aksmp-mc".to_owned()],
port: Some(6667 as u16),
use_tls: Some(false),
..Config::default()
};
if let Some(filename) = std::env::args().nth(1) {
let config = Config::load(filename)?;
let mut client = Client::from_config(config).await?;
client.identify()?;
@ -78,6 +69,6 @@ async fn main() -> Result<(), failure::Error> {
}
}
}
}
Ok(())
}