diff options
Diffstat (limited to 'src/bot.rs')
| -rw-r--r-- | src/bot.rs | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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)); |
