Remove panics on invalid env arguments
This commit is contained in:
parent
a6ce057030
commit
a56b7cbd3f
1 changed files with 7 additions and 5 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -106,19 +106,21 @@ pub fn get_config() -> Config {
|
|||
}
|
||||
}
|
||||
if let Ok(x) = env::var("COMMITTEE_ROLE") {
|
||||
let x = x.trim().parse().unwrap();
|
||||
if let Ok(x) = x.trim().parse() {
|
||||
config.committee_role = RoleId::new(x);
|
||||
}
|
||||
}
|
||||
if let Ok(x) = env::var("COMMITTEE_CATEGORY") {
|
||||
for part in x.split(',') {
|
||||
let x = part.trim().parse().unwrap();
|
||||
let Ok(x) = part.trim().parse() else { continue };
|
||||
config.committee_category.push(ChannelId::new(x));
|
||||
}
|
||||
}
|
||||
|
||||
if let Ok(x) = env::var("COMPSOC_DISCORD") {
|
||||
let x = x.trim().parse().unwrap();
|
||||
config.compsoc_server = GuildId::new(x);
|
||||
if let Ok(x) = x.trim().parse() {
|
||||
config.compsoc_server = GuildId::new(x)
|
||||
}
|
||||
}
|
||||
|
||||
config
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue