diff --git a/mgb.ini b/mgb.ini new file mode 100644 index 0000000000000000000000000000000000000000..aee6c9b1f9dedde388565a547a916e4d9c488a1d --- /dev/null +++ b/mgb.ini @@ -0,0 +1,12 @@ +[user] +id = "@some_id:matrix.org" +password = no-password +display_name = MGB-Hitagi + +[handler] +state_member = true + +[basic] +name = basic package +acl = any +admins = @martin2018:iiens.net diff --git a/mgb.yml b/mgb.yml deleted file mode 100644 index 05480b93ea991dbc5df8f98e8dbaf5c1a5ea402d..0000000000000000000000000000000000000000 --- a/mgb.yml +++ /dev/null @@ -1,8 +0,0 @@ -[user] -id=@some_id\:matrix.org -password=no-password -display_name=MGB-Hitagi - -[handler] -state_member=true -room_message=true diff --git a/src/config.rs b/src/config.rs index 46a24fcd3b6fde99830794cbc2c3e1650b9d077c..a2696c5325114245670a293fd5a65e458ccc253a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -12,7 +12,6 @@ pub struct Config { pub user_password: String, // The true user name pub handle_state_member: bool, // Install handler for state memver changes - pub handle_room_message: bool, // Install handler for room messages ini_handler: Ini, } @@ -47,9 +46,6 @@ pub fn from_file(file_name: &String) -> Result<Config, String> { Err(IniErrParse(e)) => Err(e.to_string()), Ok(conf) => { let hs_url_str = conf.get_from_or(Some("user"), "homeserver", "https://matrix.org"); - let handle_room_message_str = conf - .get_from_or(Some("handler"), "room_message", "true") - .to_string(); let handle_state_member_str = conf .get_from_or(Some("handler"), "state_member", "true") .to_string(); @@ -66,8 +62,6 @@ pub fn from_file(file_name: &String) -> Result<Config, String> { .get_from_or(Some("user"), "display_name", "MGB-Hitagi") .to_string(), homeserver_url: hs_url, - handle_room_message: <bool as FromStr>::from_str(&handle_room_message_str) - .unwrap_or(false), handle_state_member: <bool as FromStr>::from_str(&handle_state_member_str) .unwrap_or(false), ini_handler: conf, @@ -84,8 +78,11 @@ pub fn write_default(file_name: &String) -> Result<(), String> { .set("password", "no-password") .set("display_name", "MGB-Hitagi"); conf.with_section(Some("handler")) - .set("state_member", "true") - .set("room_message", "true"); + .set("state_member", "true"); + conf.with_section(Some("basic")) + .set("name", "basic package") + .set("acl", "any") + .set("admins", "@some_id:matrix.org"); match conf.write_to_file_policy(file_name, ini::EscapePolicy::Everything) { Ok(()) => { info!("Default config file written to {}", file_name); @@ -104,7 +101,7 @@ pub fn check_argument_or_abort(should_write_default: bool) { .last() .unwrap() .to_string() - + ".yml"; + + ".ini"; if Path::new(&default_file).exists() { error!( "Args count is {}, you need to only specify the config file for the bot",