aboutsummaryrefslogtreecommitdiff
path: root/src/bot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bot.rs')
-rw-r--r--src/bot.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bot.rs b/src/bot.rs
index 23e67c1..f74d581 100644
--- a/src/bot.rs
+++ b/src/bot.rs
@@ -1,7 +1,7 @@
use std::{
sync::Mutex,
fs::File,
- result::Result as StdResult,
+ result::Result as StdResult, path::PathBuf, str::FromStr,
};
use serenity::{
@@ -97,7 +97,10 @@ lazy_static! {
};
static ref RESTRICT_IDS: FnvHashSet<u64> = {
- let restrict_ids = File::open("restrict.json")
+ let default_path = PathBuf::from_str("restrict.json").unwrap();
+ let restrict_path = CONFIG.restrict.as_ref().unwrap_or(&default_path);
+
+ let restrict_ids = File::open(restrict_path)
.map_err(Error::from)
.and_then(|f| serde_json::from_reader::<_, Vec<u64>>(f).map_err(Error::from));