diff --git a/TODO.md b/TODO.md index 6609c7c..62d8d71 100644 --- a/TODO.md +++ b/TODO.md @@ -4,8 +4,10 @@ - + ยจ + - [ ] Security that only allows bk mods to run these commands - [ ] Allow updating the data autonomously and via manual commands. + - [ ] 30-minute schedule - [ ] Manually add posts - [ ] via `u/[bot] add` diff --git a/src/bk_week_cmds.rs b/src/bk_week_cmds.rs index e66a99c..5c03cd5 100644 --- a/src/bk_week_cmds.rs +++ b/src/bk_week_cmds.rs @@ -159,7 +159,7 @@ pub async fn bk_week_add( if let Some(bk_week) = reddit_data.get(BK_WEEK) { let a = approve.unwrap_or_else(|| false); - let r = websocket::send_cmd_json("add_post_url", json!([&url, a])).await.unwrap(); + let r = websocket::send_cmd_json("add_post_url", json!([&url, a, true])).await.unwrap(); if !r["value"].as_bool().unwrap() { send_msg( diff --git a/src/main.rs b/src/main.rs index 51adb76..34368d5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,6 @@ use tokio::sync::Mutex; use serde_json; -// TODO: /bk_week_adds sets as added by bot instead of human // TODO: bot command permissions // TODO: bk_mod verification system diff --git a/src/python/posts.py b/src/python/posts.py index e104417..5ec7d7f 100644 --- a/src/python/posts.py +++ b/src/python/posts.py @@ -105,7 +105,7 @@ async def from_url(bot: botPy.Bot, url: str) -> tuple[bool, models.Submission]: return False, None -def get_post_details(post: models.Submission) -> data.PostData: +def get_post_details(post: models.Submission, added_by_h: bool = False) -> data.PostData: media = has_media(post) return data.PostData( @@ -115,16 +115,17 @@ def get_post_details(post: models.Submission) -> data.PostData: int(post.created_utc), media[1], media[3], - added_by_bot = True, + added_by_bot = not added_by_h, + added_by_human = added_by_h ) -async def add_post_url(bot, url: str, approve: bool) -> bool: +async def add_post_url(bot, url: str, approve: bool, added_by_h: bool = False) -> bool: result, post = await from_url(bot, url) if not result: return False - post_data = get_post_details(post) + post_data = get_post_details(post, added_by_h) post_data.approved_by_human = approve return data.add_post_to_data(bot, post_data, True) \ No newline at end of file