bin/tg.sh
2021-03-24 13:02:30 +03:00

24 lines
487 B
Bash
Executable File

#!/bin/bash
echo $0 $1 $2 >>/tmp/tgargs
if [ -z "$1" ] || [ -z "$2" ]; then exit
fi
message=$( echo "$1" | sed 's/"//g' | sed "s/'//g")
apiToken="373934223:AAHOML90vOtbSCWmCmxPJTBjljoY0IeZ2k0"
chatId="$2";
send() {
#echo "curl -X POST https://api.telegram.org/bot$apiToken/sendMessage -d text=\"$message\" -d chat_id=$chatId"
curl -X POST https://api.telegram.org/bot$apiToken/sendMessage -d text="$message" -d chat_id=$chatId
}
#
if [[ ! -z "$message" ]]; then
send
fi