Make bot use a config.toml
This commit is contained in:
parent
9ecfa6765e
commit
f7e672890b
15
src/main.rs
15
src/main.rs
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue