From fb1617d6d9c07e14e70a024c02b255b78b0079e2 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Sun, 17 Mar 2024 18:40:12 -0300 Subject: [PATCH 1/5] minor spelling mistake --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c736061..8637fdc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ test ModulatingForceBot ``` login_name = -access_token = +access_token = bot_channels = , prefix = ``` \ No newline at end of file From 5fb373c522abbf350596e7c0ed98d7b4ec015513 Mon Sep 17 00:00:00 2001 From: haruyuumei Date: Sun, 17 Mar 2024 19:12:33 -0300 Subject: [PATCH 2/5] bot admins change --- src/core/identity.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/identity.rs b/src/core/identity.rs index 877fb6c..6392eb3 100644 --- a/src/core/identity.rs +++ b/src/core/identity.rs @@ -11,10 +11,19 @@ use crate::core::bot_actions::actions_util::{self, BotAR}; use crate::core::botinstance::ChType; use crate::core::botlog; use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesManager}; +use dotenv::dotenv; +use std::env; fn adminvector() -> Vec { - vec![String::from("ModulatingForce")] - //vec![] + // vec![String::from("ModulatingForce")] + // //vec![] + dotenv().ok(); + let mut admins = Vec::new(); + + for admin in env::var("bot_admins").unwrap().split(',') { + admins.push(String::from(admin)) + } + admins } pub async fn init(mgr: Arc) { From f7881fa07d5ff5a6d1295eaf80c88214437df746 Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:29:22 -0400 Subject: [PATCH 3/5] adj adminvector() --- README.md | 1 + src/core/identity.rs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) 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 } From 4b849cfed64984355a8141bb245db3d7c5ac378a Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:51:53 -0400 Subject: [PATCH 4/5] comments cleanup --- src/core/identity.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/core/identity.rs b/src/core/identity.rs index 42bc4c7..effb317 100644 --- a/src/core/identity.rs +++ b/src/core/identity.rs @@ -15,21 +15,9 @@ use dotenv::dotenv; use std::env; fn adminvector() -> Vec { - // vec![String::from("ModulatingForce")] - // //vec![] dotenv().ok(); let mut admins = Vec::new(); - // 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)) From 7f49693a942366a9efe05215e16629ae1b872b58 Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:47:06 -0400 Subject: [PATCH 5/5] clippy --- src/core/identity.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/core/identity.rs b/src/core/identity.rs index 5f7fac1..61c09dc 100644 --- a/src/core/identity.rs +++ b/src/core/identity.rs @@ -21,9 +21,6 @@ use crate::core::botmodules::{BotActionTrait, BotCommand, BotModule, ModulesMana use dotenv::dotenv; use std::env; -use dotenv::dotenv; -use std::env; - fn adminvector() -> Vec { dotenv().ok(); let mut admins = Vec::new();