Add sendraw and anyone functions

This commit is contained in:
Michael De Roover 2020-12-31 17:53:29 +01:00
parent 6c0ecb5a5f
commit 9e4ba7eaaa
Signed by: vim
GPG Key ID: 075496E232CE04CB

View File

@ -13,8 +13,12 @@ user=$(jq -r '.message.from.username' <<< $input)
sendmsg(){
# Escape any special characters first, see https://0x0.st/NO7J.
fmt=$(sed 's/[][~!@#$%^&*()-_=+{}\|;:",<.>/?'"'"']/\\&/g' <<< $1 | sed 's/\t//g')
sendraw "$fmt"
}
sendraw(){
curl -X POST "https://api.telegram.org/bot$token/sendMessage" \
-d "chat_id=$chat" -d "parse_mode=markdownv2" -d "text=$fmt"
-d "chat_id=$chat" -d "parse_mode=markdownv2" \
-d "disable_web_page_preview=true" -d "text=$1"
}
help(){
@ -65,6 +69,10 @@ id(){
sendmsg "Chat ID: $chat"
}
anyone(){
sendraw "Quite possibly\. [Why do you ask?](https://dontasktoask.com)"
}
tag(){
sendmsg "Please stand by, he'll get to your message soon™..."
}
@ -88,6 +96,7 @@ case "$cmd" in
/cv*|/corona*) cv ;;
/id*) id ;;
/term*) term ;;
!anyone) anyone ;;
*@ghnou*) tag ;;
*@konatasanbot*) hiya ;;
esac