mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 00:08:54 +00:00
Override the soft ban database into store on update
This commit is contained in:
parent
cf831fae87
commit
b9776bddde
1 changed files with 4 additions and 3 deletions
|
@ -110,9 +110,9 @@ pub async fn watch_soft_bans(cache_http: Arc<CacheAndHttp>, data: AppData) {
|
||||||
// Scope so that locks are released
|
// Scope so that locks are released
|
||||||
{
|
{
|
||||||
// Poll the data for any changes.
|
// Poll the data for any changes.
|
||||||
let db = data.read().await;
|
let data = data.read().await;
|
||||||
let db = SoftBans::open(&*db);
|
let mut data = SoftBans::open(&*data);
|
||||||
let mut db = db.borrow().unwrap().clone();
|
let mut db = data.borrow().unwrap().clone();
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
for (server_id, bans) in db.iter_mut() {
|
for (server_id, bans) in db.iter_mut() {
|
||||||
let server_name: String = match server_id.to_partial_guild(&*cache_http.http).await
|
let server_name: String = match server_id.to_partial_guild(&*cache_http.http).await
|
||||||
|
@ -145,6 +145,7 @@ pub async fn watch_soft_bans(cache_http: Arc<CacheAndHttp>, data: AppData) {
|
||||||
eprintln!("Error while scanning soft-bans list: {}", e)
|
eprintln!("Error while scanning soft-bans list: {}", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*(data.borrow_mut().unwrap()) = db;
|
||||||
}
|
}
|
||||||
// Sleep the thread for a minute
|
// Sleep the thread for a minute
|
||||||
tokio::time::sleep(std::time::Duration::from_secs(60)).await
|
tokio::time::sleep(std::time::Duration::from_secs(60)).await
|
||||||
|
|
Loading…
Add table
Reference in a new issue