Add sendraw and anyone functions

This commit is contained in:
2020-12-31 17:53:29 +01:00
parent 6c0ecb5a5f
commit 9e4ba7eaaa

View File

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