From e4a8cce725266ede78c523584c9628a567032d44 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sat, 9 Nov 2024 16:17:43 +0000 Subject: [PATCH] feat: new env var for teh specific channel that the general chat stuff will be under --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 5a9d43d..144b5e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ use chrono::{Datelike, SecondsFormat, Utc}; use dotenvy::dotenv; use rand::{distributions::Alphanumeric, thread_rng, Rng}; use serenity::client::Context; -use serenity::model::id::{GuildId, RoleId}; +use serenity::model::id::{ChannelId, GuildId, RoleId}; use serenity::model::prelude::application_command::ApplicationCommandInteraction; use serenity::prelude::TypeMapKey; use std::{env, sync::Arc}; @@ -31,6 +31,7 @@ pub struct Config { // discord server for committee pub committee_server: GuildId, pub committee_role: RoleId, + pub committee_category: ChannelId, } impl TypeMapKey for Config { type Value = Arc>; @@ -54,6 +55,7 @@ pub fn get_config() -> Config { wolves_api: "".to_string(), committee_server: GuildId(0), committee_role: RoleId(0), + committee_category: ChannelId(0), }; if let Ok(x) = env::var("DATABASE_HOME") { @@ -98,6 +100,11 @@ pub fn get_config() -> Config { config.committee_role = RoleId(x); } } + if let Ok(x) = env::var("COMMITTEE_CATEGORY") { + if let Ok(x) = x.trim().parse::() { + config.committee_category = ChannelId(x); + } + } config }