forked from Skynet/discord-bot
feat: use values from teh env file to dictate the servers
This commit is contained in:
parent
72226cc59b
commit
a6eff75e39
5 changed files with 33 additions and 29 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -32,7 +32,7 @@ pub struct Config {
|
|||
// discord server for committee
|
||||
pub committee_server: GuildId,
|
||||
pub committee_role: RoleId,
|
||||
pub committee_category: ChannelId,
|
||||
pub committee_category: Vec<ChannelId>,
|
||||
|
||||
// items pertaining to compsoc only
|
||||
pub compsoc_server: GuildId,
|
||||
|
@ -60,7 +60,7 @@ pub fn get_config() -> Config {
|
|||
wolves_api: "".to_string(),
|
||||
committee_server: GuildId::new(1),
|
||||
committee_role: RoleId::new(1),
|
||||
committee_category: ChannelId::new(1),
|
||||
committee_category: vec![],
|
||||
compsoc_server: GuildId::new(1),
|
||||
};
|
||||
|
||||
|
@ -109,8 +109,10 @@ pub fn get_config() -> Config {
|
|||
}
|
||||
}
|
||||
if let Ok(x) = env::var("COMMITTEE_CATEGORY") {
|
||||
if let Ok(x) = x.trim().parse::<u64>() {
|
||||
config.committee_category = ChannelId::new(x);
|
||||
for part in x.split(",") {
|
||||
if let Ok(x) = part.trim().parse::<u64>() {
|
||||
config.committee_category.push(ChannelId::new(x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue