1
0
Fork 0

idc changed a lot of files

This commit is contained in:
Arthur Khachaturov 2024-11-28 22:19:16 +03:00
parent 628baf3eea
commit 94d2955ab0
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
31 changed files with 267 additions and 80 deletions

View file

@ -67,6 +67,7 @@ die() {
main() {
msg=""
while [ $# -gt 0 ]; do
case "$1" in
'-h'|'--help') help; exit 0 ;;
@ -74,16 +75,19 @@ main() {
'-c'|'--code') tg__code=1; tg__params[parse_mode]='HTML' ;;
'-r'|'--print-response') print_response=1 ;;
'--tg'*) tg__params["${1#--tg}"]="$2"; shift ;;
*) msg+=" $1";;
esac
shift
done
[ -t 0 ] && die "Can't run on stdin!"
resp="$(tg::send_message "$@" 2>/dev/null)"
if [ -z "$msg" ]; then
[ -t 0 ] && die "Can't run on stdin!"
resp="$(tg::send_message "$@" 2>/dev/null)"
else
resp="$(tg::send_message "$@" 2>/dev/null <<<"$msg")"
fi
[ -n "${print_response:+_}" ] && echo "$resp"
[ "$(jq .ok <<<"$resp")" = "true" ] || jq <<< "$resp" >&2
}