Bot admins in env file #22
2 changed files with 12 additions and 3 deletions
|
@ -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>
|
||||
```
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue