fixed so config now updates properly

This commit is contained in:
2025-03-20 20:36:35 +01:00
parent 30c9960aec
commit a32e477bf6
3 changed files with 5 additions and 2 deletions
+1
View File
@@ -9,6 +9,7 @@
<!-- - [x] Some kind of voting system. -->
<!-- - [x] ~~`/bk_week_top [category] [amount]` to get the top N posts in a category (e.g upvotes)~~ -->
<!-- - [x] ~~`/bk_cfg_sr [subreddit]` to change the target subreddit(s)~~ -->
- [ ] Allow disabling bk_week
- [ ] Language files?
- [ ] Allow updating the data autonomously and via manual commands.
<!-- - [ ] 10-minute schedule for updating Discord channel (IMPOSSIBLE / REALLY FUCKING HARD) -->
+2 -1
View File
@@ -6,7 +6,8 @@
"bk_mods": [
"USER ID 1",
"USER ID 2"
]
],
"bk_week_disabled": false
}
}
}
+2 -1
View File
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::process;
use std::error::Error as StdErr;
use crate::data::{dc_add_server, get_mutex_data};
use crate::data::{dc_add_server, get_mutex_data, read_cfg_data};
use crate::websocket::send_cmd_json;
use crate::{data, Context, Data, Error};
use crate::messages::{edit_reply, send_embed, send_msg, Author, EmbedOptions, MANDATORY_MSG};
@@ -255,6 +255,7 @@ pub async fn reload_cfg(
ctx: Context<'_>
) -> Result<(), Error>
{
read_cfg_data(&ctx.data(), false).await;
let d = get_mutex_data(&ctx.data().cfg).await?;
let d_str = serde_json::to_string(&d)?;
let r = send_cmd_json("update_cfg", Some(json!([d_str]))).await;