Merge pull request 'Bot admins in env file' (#22) from haru_test into master
All checks were successful
ci/woodpecker/push/cargo-checks Pipeline was successful
ci/woodpecker/pr/cargo-checks Pipeline was successful

Reviewed-on: #22
This commit is contained in:
modulatingforce 2024-04-09 13:48:55 -04:00
commit b8c33d2339
2 changed files with 12 additions and 3 deletions

View file

@ -9,9 +9,10 @@ test ModulatingForceBot
```
login_name = <botname>
access_token = <oath token>
access_token = <oauth token>
bot_channels = <chnl1>,<chnl2>
prefix = <prefix>
bot_admins = <admins>
```

View file

@ -18,12 +18,20 @@ use crate::core::bot_actions::ExecBodyParams;
use crate::core::botinstance::{Channel,ChangeResult};
use crate::core::botlog;
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
use dotenv::dotenv;
use std::env;
fn adminvector() -> Vec<String> {
vec![String::from("ModulatingForce")]
dotenv().ok();
let mut admins = Vec::new();
if let Ok(value) = env::var("bot_admins") {
for admin in value.split(',') {
admins.push(String::from(admin))
}
}
admins
}