feat: add support for passing teh compsoc server id via env

This commit is contained in:
silver 2025-06-16 20:20:21 +01:00
parent f841039c53
commit 72226cc59b
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D

View file

@ -33,6 +33,9 @@ pub struct Config {
pub committee_server: GuildId,
pub committee_role: RoleId,
pub committee_category: ChannelId,
// items pertaining to compsoc only
pub compsoc_server: GuildId,
}
impl TypeMapKey for Config {
type Value = Arc<RwLock<Config>>;
@ -58,6 +61,7 @@ pub fn get_config() -> Config {
committee_server: GuildId::new(1),
committee_role: RoleId::new(1),
committee_category: ChannelId::new(1),
compsoc_server: GuildId::new(1),
};
if let Ok(x) = env::var("DATABASE_HOME") {
@ -110,6 +114,12 @@ pub fn get_config() -> Config {
}
}
if let Ok(x) = env::var("COMPSOC_DISCORD") {
if let Ok(x) = x.trim().parse::<u64>() {
config.compsoc_server = GuildId::new(x);
}
}
config
}