forked from Skynet/discord-bot
Refactors for less nesting, slight performance and memory improvement for count command
This commit is contained in:
parent
6353d77360
commit
f3f08962a4
9 changed files with 161 additions and 287 deletions
12
src/lib.rs
12
src/lib.rs
|
@ -106,21 +106,19 @@ pub fn get_config() -> Config {
|
|||
}
|
||||
}
|
||||
if let Ok(x) = env::var("COMMITTEE_ROLE") {
|
||||
if let Ok(x) = x.trim().parse::<u64>() {
|
||||
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(',') {
|
||||
if let Ok(x) = part.trim().parse::<u64>() {
|
||||
config.committee_category.push(ChannelId::new(x));
|
||||
}
|
||||
for id in x.split(',').flat_map(|part| part.trim().parse()) {
|
||||
config.committee_category.push(ChannelId::new(id));
|
||||
}
|
||||
}
|
||||
|
||||
if let Ok(x) = env::var("COMPSOC_DISCORD") {
|
||||
if let Ok(x) = x.trim().parse::<u64>() {
|
||||
config.compsoc_server = GuildId::new(x);
|
||||
if let Ok(x) = x.trim().parse() {
|
||||
config.compsoc_server = GuildId::new(x)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue