feat: new env var for teh specific channel that the general chat stuff will be under
This commit is contained in:
parent
5b22f699d6
commit
e4a8cce725
1 changed files with 8 additions and 1 deletions
|
@ -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<RwLock<Config>>;
|
||||
|
@ -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::<u64>() {
|
||||
config.committee_category = ChannelId(x);
|
||||
}
|
||||
}
|
||||
|
||||
config
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue