1
0

add mitra

This commit is contained in:
syui 2024-02-23 15:23:14 +09:00
parent 6855cc78b4
commit a6fa5c2ef5
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
2 changed files with 36 additions and 0 deletions

12
.config/ai/scpt/mitractl.zsh Executable file
View File

@ -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

View File

@ -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;