From 2ddc74ed50d552ca22737704a76fc6087470800e Mon Sep 17 00:00:00 2001 From: syui Date: Mon, 26 Feb 2024 00:16:16 +0900 Subject: [PATCH] fix --- .config/ai/scpt | 2 +- src/bot.rs | 2 ++ src/main.rs | 10 +++++++++- src/reply_og.rs | 6 ++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.config/ai/scpt b/.config/ai/scpt index 3dc38ce..ef447c4 160000 --- a/.config/ai/scpt +++ b/.config/ai/scpt @@ -1 +1 @@ -Subproject commit 3dc38ce5fae8cf217864545a3b09c71ce5b066de +Subproject commit ef447c49dc905a85c56d44f8b955fd8a780ee7b7 diff --git a/src/bot.rs b/src/bot.rs index 540327e..6d09ecd 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -273,6 +273,8 @@ pub fn c_bot(c: &Context) { .arg(&uri) .arg(&prompt) .arg(&prompt_sub) + .arg(&cid_root) + .arg(&uri_root) .output() .expect("zsh"); let d = String::from_utf8_lossy(&output.stdout); diff --git a/src/main.rs b/src/main.rs index 57eeea7..e86ebf3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -140,6 +140,12 @@ fn main() { Flag::new("cid", FlagType::String) .alias("c"), ) + .flag( + Flag::new("uri-root", FlagType::String) + ) + .flag( + Flag::new("cid-root", FlagType::String) + ) .flag( Flag::new("link", FlagType::String) .alias("l"), @@ -569,11 +575,13 @@ fn reply_og(c: &Context) { let link = c.string_flag("link").unwrap(); let cid = c.string_flag("cid").unwrap(); let uri = c.string_flag("uri").unwrap(); + let cid_root = c.string_flag("cid-root").unwrap(); + let uri_root = c.string_flag("uri-root").unwrap(); let title = c.string_flag("title").unwrap(); let desc = c.string_flag("description").unwrap(); let img = c.string_flag("img").unwrap(); let h = async { - let str = reply_og::post_request(m, link, cid, uri, img, title, desc); + let str = reply_og::post_request(m, link, cid, uri, cid_root, uri_root, img, title, desc); println!("{}", str.await); }; let res = tokio::runtime::Runtime::new().unwrap().block_on(h); diff --git a/src/reply_og.rs b/src/reply_og.rs index af27c9d..8687a2d 100644 --- a/src/reply_og.rs +++ b/src/reply_og.rs @@ -10,6 +10,8 @@ pub async fn post_request( link: String, cid: String, uri: String, + cid_root: String, + uri_root: String, img: String, title: String, description: String, @@ -49,8 +51,8 @@ pub async fn post_request( }, "reply": { "root": { - "cid": cid.to_string(), - "uri": uri.to_string() + "cid": cid_root.to_string(), + "uri": uri_root.to_string() }, "parent": { "cid": cid.to_string(),