smol bot
Diffstat (limited to 'src/bot/ownership.rs')
| -rw-r--r-- | src/bot/ownership.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bot/ownership.rs b/src/bot/ownership.rs index d7aacc1..ab8639a 100644 --- a/src/bot/ownership.rs +++ b/src/bot/ownership.rs @@ -2,7 +2,7 @@ use serenity::all::MessageId; use std::{collections::HashMap, sync::LazyLock}; use tokio::sync::Mutex; -static MAP: LazyLock<Mutex<HashMap<u64, (String, u64)>>> = LazyLock::new(|| { +pub static MAP: LazyLock<Mutex<HashMap<u64, (String, u64)>>> = LazyLock::new(|| { Mutex::new(serde_json::from_slice(&std::fs::read("repo/ownership.json").unwrap()).unwrap()) }); @@ -11,7 +11,7 @@ pub async fn insert(k: u64, v: (String, u64)) { lock.insert(k, v); std::fs::write( "repo/ownership.json", - serde_json::to_string(&*lock).unwrap(), + serde_json::to_string_pretty(&*lock).unwrap(), ) .unwrap(); } @@ -23,7 +23,7 @@ pub async fn erase(k: u64) -> Option<String> { let x = lock.remove(&k).map(|(x, _)| x); std::fs::write( "repo/ownership.json", - serde_json::to_string(&*lock).unwrap(), + serde_json::to_string_pretty(&*lock).unwrap(), ) .unwrap(); x |