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" }
{
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 s = 0;
let e = link.chars().count();
@ -117,15 +117,34 @@ pub fn c_bot(c: &Context) {
w_cid(cid.to_string(), log_file(&"n1"), true);
println!("{}", str_rep);
}
} else if com == "/diffusers" || com == "diffusers" {
let _output = Command::new(data_scpt(&"diffusers"))
} else if com == "help" {
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(&prompt)
.output()
.expect("zsh");
let _output = Command::new(data_scpt(&"diffusers_img"))
.arg(&cid)
.arg(&uri)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt)
.arg(&prompt_sub)
.output()
.expect("zsh");
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
{
let output = Command::new(data_scpt(&"card_fortune"))
let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"fortune")
.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);
@ -147,11 +171,17 @@ pub fn c_bot(c: &Context) {
println!("{}", text_limit);
w_cid(cid.to_string(), log_file(&"n1"), true);
}
} else if com == "/card" || com == "card" {
let output = Command::new(data_scpt(&"api_card"))
} else if com == "card" {
let output = Command::new(data_scpt(&"card"))
.arg(&"fav").arg(&"atproto")
.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);
@ -190,63 +220,79 @@ pub fn c_bot(c: &Context) {
}
w_cid(cid.to_string(), log_file(&"n1"), true);
}
} else if com == "/fav" || com == "fav" {
let output = Command::new(data_scpt(&"api_fav"))
.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 == "/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"))
} else if com == "fav" {
let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"fav")
.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 == "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()
.expect("zsh");
let d = String::from_utf8_lossy(&output.stdout);
@ -265,16 +311,17 @@ pub fn c_bot(c: &Context) {
println!("{}", str_rep);
w_cid(cid.to_string(), log_file(&"n1"), true);
}
} else if com == "/ten" || com == "ten" {
let output = Command::new(data_scpt(&"api_ten"))
} else if com == "ten" {
let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"ten")
.arg(&handle)
.arg(&did)
.arg(&cid)
.arg(&uri)
.arg(&prompt)
.arg(&prompt_sub)
.arg(&cid_root)
.arg(&uri_root)
.arg(&prompt)
.arg(&prompt_sub)
.output()
.expect("zsh");
let d = String::from_utf8_lossy(&output.stdout);
@ -295,10 +342,49 @@ pub fn c_bot(c: &Context) {
println!("{}", str_rep);
w_cid(cid.to_string(), log_file(&"n1"), true);
}
} else if { com == "sh" || com == "/sh" } && handle == &admin {
println!("admin:{}", admin);
let output = Command::new(data_scpt(&"arch"))
} else if com == "coin" {
let output = Command::new(data_scpt(&"ai"))
.arg(&"atproto").arg(&"coin")
.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 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()
.expect("zsh");
let d = String::from_utf8_lossy(&output.stdout);
@ -314,10 +400,18 @@ 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 {
} else if com == "mitractl" && handle == &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_sub)
.output()
.expect("zsh");
let d = String::from_utf8_lossy(&output.stdout);