From e1d22a10d48e54fcca46189ff508886c56c6503b Mon Sep 17 00:00:00 2001 From: syui Date: Fri, 23 Feb 2024 17:10:16 +0900 Subject: [PATCH] fix --- .config/ai/scpt/mitractl.zsh | 19 ++++++++++++++----- src/bot.rs | 4 +++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.config/ai/scpt/mitractl.zsh b/.config/ai/scpt/mitractl.zsh index 6a5a938..8eb5ae9 100755 --- a/.config/ai/scpt/mitractl.zsh +++ b/.config/ai/scpt/mitractl.zsh @@ -1,12 +1,21 @@ #!/bin/zsh -name=mitra-mitra-1 +#repeat 30 docker exec -it mitra-mitra-1 zsh -c "/app/mitractl generate-invite-code" |grep invite >> .config/ai/txt/mitra_invite.txt -case $1 in - generate-invite-code|invite|i|code) - docker exec -it $name bash -c "/app/mitractl generate-invite-code"|grep invite +#name=mitra-mitra-1 +#docker exec -it $name bash -c "/app/mitractl generate-invite-code"|grep invite + +f=~/.config/ai/txt/mitra_invite.txt +cat $f|awk "NR==1" + +case $OSTYPE in + darwin*) + sed -i "" 1d $f + ;; + linux*) + sed -i 1d $f ;; *) - docker exec -it $name bash -c "/app/mitractl $1"|grep invite + sed -i 1d $f ;; esac diff --git a/src/bot.rs b/src/bot.rs index 7a85276..540327e 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -321,10 +321,12 @@ pub fn c_bot(c: &Context) { let d = String::from_utf8_lossy(&output.stdout); let d = "\n".to_owned() + &d.to_string(); let text_limit = c_char(d); + link = "https://m.syu.is".to_string(); + e = link.chars().count(); if text_limit.len() > 3 { let str_rep = reply_link::post_request( text_limit.to_string(), - "https://m.syu.is".to_string(), + link.to_string(), s, e.try_into().unwrap(), cid.to_string(),