1
0
This commit is contained in:
syui 2024-02-28 21:21:43 +09:00
parent 2ddc74ed50
commit 7c5ef8af61
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
2 changed files with 166 additions and 72 deletions

@ -1 +1 @@
Subproject commit ef447c49dc905a85c56d44f8b955fd8a780ee7b7 Subproject commit b9f6ca1400cfe74e143dd211e1e9c6f176ff7794

View File

@ -96,7 +96,7 @@ pub fn c_bot(c: &Context) {
|| check_cid_run == false && { reason == "mention" || reason == "reply" } || check_cid_run == false && { reason == "mention" || reason == "reply" }
{ {
w_cid(cid.to_string(), log_file(&"n2"), true); w_cid(cid.to_string(), log_file(&"n2"), true);
if com == "/did" || com == "did" { if com == "did" {
let link = "https://plc.directory/".to_owned() + &did + &"/log"; let link = "https://plc.directory/".to_owned() + &did + &"/log";
let s = 0; let s = 0;
let e = link.chars().count(); let e = link.chars().count();
@ -117,15 +117,34 @@ pub fn c_bot(c: &Context) {
w_cid(cid.to_string(), log_file(&"n1"), true); w_cid(cid.to_string(), log_file(&"n1"), true);
println!("{}", str_rep); println!("{}", str_rep);
} }
} else if com == "/diffusers" || com == "diffusers" { } else if com == "help" {
let _output = Command::new(data_scpt(&"diffusers")) let link = "https://git.syui.ai/ai/bot/wiki/help".to_string();
let s = 0;
let e = link.chars().count();
let str_rep = reply_link::post_request(
"\n".to_string(),
link.to_string(),
s,
e.try_into().unwrap(),
cid.to_string(),
uri.to_string(),
cid_root.to_string(),
uri_root.to_string(),
)
.await;
w_cid(cid.to_string(), log_file(&"n1"), true);
println!("{}", str_rep);
} else if com == "diffusers" {
let _output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"diffusers")
.arg(&handle)
.arg(&did) .arg(&did)
.arg(&prompt)
.output()
.expect("zsh");
let _output = Command::new(data_scpt(&"diffusers_img"))
.arg(&cid) .arg(&cid)
.arg(&uri) .arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt)
.arg(&prompt_sub)
.output() .output()
.expect("zsh"); .expect("zsh");
w_cid(cid.to_string(), log_file(&"n1"), true); w_cid(cid.to_string(), log_file(&"n1"), true);
@ -133,11 +152,16 @@ pub fn c_bot(c: &Context) {
|| com.contains("うらない") == true || com.contains("うらない") == true
|| com.contains("うらなって") == true || com.contains("うらなって") == true
{ {
let output = Command::new(data_scpt(&"card_fortune")) let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"fortune")
.arg(&handle) .arg(&handle)
.arg(&did) .arg(&did)
.arg(&cid) .arg(&cid)
.arg(&uri) .arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt)
.arg(&prompt_sub)
.output() .output()
.expect("zsh"); .expect("zsh");
let d = String::from_utf8_lossy(&output.stdout); let d = String::from_utf8_lossy(&output.stdout);
@ -147,11 +171,17 @@ pub fn c_bot(c: &Context) {
println!("{}", text_limit); println!("{}", text_limit);
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" {
let output = Command::new(data_scpt(&"api_card")) let output = Command::new(data_scpt(&"card"))
.arg(&"fav").arg(&"atproto")
.arg(&handle) .arg(&handle)
.arg(&did) .arg(&did)
.arg(&cid)
.arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt) .arg(&prompt)
.arg(&prompt_sub)
.output() .output()
.expect("zsh"); .expect("zsh");
let d = String::from_utf8_lossy(&output.stdout); let d = String::from_utf8_lossy(&output.stdout);
@ -190,63 +220,79 @@ 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 == "/fav" || com == "fav" { } else if com == "fav" {
let output = Command::new(data_scpt(&"api_fav")) let output = Command::new(data_scpt(&"ai"))
.arg(&handle) .arg(&"atproto").arg(&"fav")
.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);
if text_limit.len() > 3 {
let str_rep = reply_link::post_request(
d.to_string(),
link.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 if com == "/egg" || com == "egg" {
let output = Command::new(data_scpt(&"api_egg"))
.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);
if text_limit.len() > 3 {
let str_rep = reply_link::post_request(
d.to_string(),
link.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 if com == "/nyan" || com == "nyan" {
let output = Command::new(data_scpt(&"nyancat"))
.arg(&handle) .arg(&handle)
.arg(&did) .arg(&did)
.arg(&cid) .arg(&cid)
.arg(&uri) .arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt) .arg(&prompt)
.arg(&prompt_sub)
.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);
if text_limit.len() > 3 {
let str_rep = reply_link::post_request(
d.to_string(),
link.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 if com == "egg" {
let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"egg")
.arg(&handle)
.arg(&did)
.arg(&cid)
.arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt)
.arg(&prompt_sub)
.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);
if text_limit.len() > 3 {
let str_rep = reply_link::post_request(
d.to_string(),
link.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 if com == "nyan" {
let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"nyan")
.arg(&handle)
.arg(&did)
.arg(&cid)
.arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt)
.arg(&prompt_sub)
.output() .output()
.expect("zsh"); .expect("zsh");
let d = String::from_utf8_lossy(&output.stdout); let d = String::from_utf8_lossy(&output.stdout);
@ -265,16 +311,17 @@ pub fn c_bot(c: &Context) {
println!("{}", str_rep); println!("{}", str_rep);
w_cid(cid.to_string(), log_file(&"n1"), true); w_cid(cid.to_string(), log_file(&"n1"), true);
} }
} else if com == "/ten" || com == "ten" { } else if com == "ten" {
let output = Command::new(data_scpt(&"api_ten")) let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"ten")
.arg(&handle) .arg(&handle)
.arg(&did) .arg(&did)
.arg(&cid) .arg(&cid)
.arg(&uri) .arg(&uri)
.arg(&prompt)
.arg(&prompt_sub)
.arg(&cid_root) .arg(&cid_root)
.arg(&uri_root) .arg(&uri_root)
.arg(&prompt)
.arg(&prompt_sub)
.output() .output()
.expect("zsh"); .expect("zsh");
let d = String::from_utf8_lossy(&output.stdout); let d = String::from_utf8_lossy(&output.stdout);
@ -295,10 +342,49 @@ pub fn c_bot(c: &Context) {
println!("{}", str_rep); println!("{}", str_rep);
w_cid(cid.to_string(), log_file(&"n1"), true); w_cid(cid.to_string(), log_file(&"n1"), true);
} }
} else if { com == "sh" || com == "/sh" } && handle == &admin { } else if com == "coin" {
println!("admin:{}", admin); let output = Command::new(data_scpt(&"ai"))
let output = Command::new(data_scpt(&"arch")) .arg(&"atproto").arg(&"coin")
.arg(&handle)
.arg(&did)
.arg(&cid)
.arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt) .arg(&prompt)
.arg(&prompt_sub)
.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(),
link.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 if com == "sh" && handle == &admin {
println!("admin:{}", admin);
let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"sh")
.arg(&handle)
.arg(&did)
.arg(&cid)
.arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt)
.arg(&prompt_sub)
.output() .output()
.expect("zsh"); .expect("zsh");
let d = String::from_utf8_lossy(&output.stdout); let d = String::from_utf8_lossy(&output.stdout);
@ -314,10 +400,18 @@ pub fn c_bot(c: &Context) {
.await; .await;
println!("{}", str_rep); println!("{}", str_rep);
w_cid(cid.to_string(), log_file(&"n1"), true); w_cid(cid.to_string(), log_file(&"n1"), true);
} else if { com == "mitractl" || com == "/mitractl" } && handle == &admin { } else if com == "mitractl" && handle == &admin {
println!("admin:{}", admin); println!("admin:{}", admin);
let output = Command::new(data_scpt(&"mitractl")) let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"mitra")
.arg(&handle)
.arg(&did)
.arg(&cid)
.arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt) .arg(&prompt)
.arg(&prompt_sub)
.output() .output()
.expect("zsh"); .expect("zsh");
let d = String::from_utf8_lossy(&output.stdout); let d = String::from_utf8_lossy(&output.stdout);