From f4063d32d95d0ad2bc0a4e68738d2b039677dd81 Mon Sep 17 00:00:00 2001 From: syui Date: Tue, 13 Feb 2024 19:35:37 +0900 Subject: [PATCH] fix --- src/bot.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bot.rs b/src/bot.rs index 924722b..59e2794 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -51,7 +51,6 @@ pub fn c_bot(c: &Context) { text = &n[i].record.text.as_ref().unwrap(); } let vec: Vec<&str> = text.split_whitespace().collect(); - let com = vec[1].trim().to_string(); let handlev: Vec<&str> = handle.split('.').collect(); let mut handlev = handlev[0].trim().to_string(); @@ -60,10 +59,13 @@ pub fn c_bot(c: &Context) { let mut e = link.chars().count(); let mut prompt = "none".to_string(); + let mut com = "none".to_string(); if reason == "mention" { prompt = vec[2..].join(" "); + com = vec[1].trim().to_string(); } else if reason == "reply" { prompt = vec[1..].join(" "); + com = vec[0].trim().to_string(); } if prompt.is_empty() == false { println!("{}", prompt); @@ -97,7 +99,7 @@ pub fn c_bot(c: &Context) { w_cid(cid.to_string(), log_file(&"n1"), true); } } else if com == "/card" || com == "card" { - let output = Command::new(data_scpt(&"api_card.zsh")).arg(&handle).arg(&did).arg(&prompt).output().expect("zsh"); + let output = Command::new(data_scpt(&"api_card")).arg(&handle).arg(&did).arg(&prompt).output().expect("zsh"); let d = String::from_utf8_lossy(&output.stdout); let dd = "\n".to_owned() + &d.to_string(); let text_limit = c_char(dd);