1
0
This commit is contained in:
syui 2024-02-13 19:35:37 +09:00
parent 087310e94f
commit f4063d32d9
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56

View File

@ -51,7 +51,6 @@ pub fn c_bot(c: &Context) {
text = &n[i].record.text.as_ref().unwrap(); text = &n[i].record.text.as_ref().unwrap();
} }
let vec: Vec<&str> = text.split_whitespace().collect(); let vec: Vec<&str> = text.split_whitespace().collect();
let com = vec[1].trim().to_string();
let handlev: Vec<&str> = handle.split('.').collect(); let handlev: Vec<&str> = handle.split('.').collect();
let mut handlev = handlev[0].trim().to_string(); 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 e = link.chars().count();
let mut prompt = "none".to_string(); let mut prompt = "none".to_string();
let mut com = "none".to_string();
if reason == "mention" { if reason == "mention" {
prompt = vec[2..].join(" "); prompt = vec[2..].join(" ");
com = vec[1].trim().to_string();
} else if reason == "reply" { } else if reason == "reply" {
prompt = vec[1..].join(" "); prompt = vec[1..].join(" ");
com = vec[0].trim().to_string();
} }
if prompt.is_empty() == false { if prompt.is_empty() == false {
println!("{}", prompt); println!("{}", prompt);
@ -97,7 +99,7 @@ pub fn c_bot(c: &Context) {
w_cid(cid.to_string(), log_file(&"n1"), true); w_cid(cid.to_string(), log_file(&"n1"), true);
} }
} else if com == "/card" || com == "card" { } 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 d = String::from_utf8_lossy(&output.stdout);
let dd = "\n".to_owned() + &d.to_string(); let dd = "\n".to_owned() + &d.to_string();
let text_limit = c_char(dd); let text_limit = c_char(dd);