i kinda forgot to commit. Anyways, i made the config into toml, edited readme, and... refactored code...

This commit is contained in:
2025-06-07 13:14:50 +02:00
parent c0793562e3
commit 4c21b6da4e
20 changed files with 149 additions and 101 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
use regex::Regex;
use serde_json::Value;
use crate::{data::get_mutex_data, messages::{make_post_embed, make_removed_embed, send_embed}, Context, Error};
use crate::{data::get_toml_mutex, messages::{make_post_embed, make_removed_embed, send_embed}, Context, Error};
pub fn is_bk_mod(mod_list: Vec<u64>, uid: u64) -> bool {
return mod_list.contains(&uid);
@@ -35,7 +35,7 @@ pub async fn send_embed_for_removed(ctx: Context<'_>, url: &str, post: &Value) {
pub async fn get_readable_subreddits(ctx: Context<'_>) -> Result<String, Error> {
let d = get_mutex_data(&ctx.data().cfg).await?;
let d = get_toml_mutex(&ctx.data().cfg).await.unwrap();
let sr = d["reddit"]["subreddits"].as_str().ok_or("Item of key \"subreddit\" is not a string type.\nTrace: `get_readable_subreddits -> let sr = ...`")?;
let split: Vec<&str> = sr.split("+").collect();
let join = split.join(", r/");