Merge pull request 'Bot admins in env file' (#22) from haru_test into master
Reviewed-on: #22
This commit is contained in:
commit
b8c33d2339
2 changed files with 12 additions and 3 deletions
|
@ -9,9 +9,10 @@ test ModulatingForceBot
|
||||||
|
|
||||||
```
|
```
|
||||||
login_name = <botname>
|
login_name = <botname>
|
||||||
access_token = <oath token>
|
access_token = <oauth token>
|
||||||
bot_channels = <chnl1>,<chnl2>
|
bot_channels = <chnl1>,<chnl2>
|
||||||
prefix = <prefix>
|
prefix = <prefix>
|
||||||
|
bot_admins = <admins>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,12 +18,20 @@ use crate::core::bot_actions::ExecBodyParams;
|
||||||
use crate::core::botinstance::{Channel,ChangeResult};
|
use crate::core::botinstance::{Channel,ChangeResult};
|
||||||
use crate::core::botlog;
|
use crate::core::botlog;
|
||||||
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
|
use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager};
|
||||||
|
|
||||||
use dotenv::dotenv;
|
use dotenv::dotenv;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn adminvector() -> Vec<String> {
|
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