diff --git a/README.md b/README.md index 8637fdc..33fdb59 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,5 @@ login_name = access_token = bot_channels = , prefix = +bot_admins = ``` \ No newline at end of file diff --git a/src/core/identity.rs b/src/core/identity.rs index 6392eb3..42bc4c7 100644 --- a/src/core/identity.rs +++ b/src/core/identity.rs @@ -20,9 +20,22 @@ fn adminvector() -> Vec { dotenv().ok(); let mut admins = Vec::new(); - for admin in env::var("bot_admins").unwrap().split(',') { - admins.push(String::from(admin)) + // for admin in env::var("bot_admins").unwrap().split(',') { + // admins.push(String::from(admin)) + // } + + // 03.17 - Forcen - Suggesting below instead : + /* + - this will push only if env::var() returns Ok() ; + otherwise (like in Err(_)) do nothing + */ + + if let Ok(value) = env::var("bot_admins") { + for admin in value.split(',') { + admins.push(String::from(admin)) + } } + admins }