This commit is contained in:
parent
5fb373c522
commit
f7881fa07d
2 changed files with 16 additions and 2 deletions
|
@ -12,4 +12,5 @@ login_name = <botname>
|
||||||
access_token = <oauth token>
|
access_token = <oauth token>
|
||||||
bot_channels = <chnl1>,<chnl2>
|
bot_channels = <chnl1>,<chnl2>
|
||||||
prefix = <prefix>
|
prefix = <prefix>
|
||||||
|
bot_admins = <admins>
|
||||||
```
|
```
|
|
@ -20,9 +20,22 @@ fn adminvector() -> Vec<String> {
|
||||||
dotenv().ok();
|
dotenv().ok();
|
||||||
let mut admins = Vec::new();
|
let mut admins = Vec::new();
|
||||||
|
|
||||||
for admin in env::var("bot_admins").unwrap().split(',') {
|
// 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.push(String::from(admin))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
admins
|
admins
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue