diff --git a/.config/ai/scpt/mitractl.zsh b/.config/ai/scpt/mitractl.zsh new file mode 100755 index 0000000..7c60be3 --- /dev/null +++ b/.config/ai/scpt/mitractl.zsh @@ -0,0 +1,12 @@ +#!/bin/zsh + +name=mitra-mitra-1 + +case $1 in + generate-invite-code|invite|i|code) + docker exec -it $name bash -c "/app/mitractl $1"|grep invite + ;; + *) + docker exec -it $name bash -c "/app/mitractl $1"|grep invite + ;; +esac diff --git a/src/bot.rs b/src/bot.rs index b521946..5eda142 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -309,6 +309,30 @@ pub fn c_bot(c: &Context) { .await; println!("{}", str_rep); w_cid(cid.to_string(), log_file(&"n1"), true); + } else if { com == "mitractl" || com == "/mitractl" } && handle == &admin { + println!("admin:{}", admin); + let output = Command::new(data_scpt(&"mitractl")) + .arg(&prompt) + .output() + .expect("zsh"); + let d = String::from_utf8_lossy(&output.stdout); + let d = "\n".to_owned() + &d.to_string(); + let text_limit = c_char(d); + if text_limit.len() > 3 { + let str_rep = reply_link::post_request( + text_limit.to_string(), + "https://m.syu.is".to_string(), + s, + e.try_into().unwrap(), + cid.to_string(), + uri.to_string(), + cid_root.to_string(), + uri_root.to_string(), + ) + .await; + println!("{}", str_rep); + w_cid(cid.to_string(), log_file(&"n1"), true); + } } else { // openai let str_openai = openai::post_request(prompt.to_string()).await;