22 lines
595 B
Bash
Executable File
22 lines
595 B
Bash
Executable File
#!/bin/bash
|
|
|
|
MESSAGE=$(echo -e "$3")
|
|
|
|
token=$1
|
|
echo chat_id=$2
|
|
echo text=$MESSAGE
|
|
|
|
response=$(curl -s -X -v POST "https://api.telegram.org/bot$token/sendMessage" \
|
|
-d "chat_id=$2" \
|
|
-d "parse_mode=MarkdownV2" \
|
|
-d "link_preview_options={\"is_disabled\":true}" \
|
|
-d "text=test: $MESSAGE")
|
|
|
|
# if command -v jq >/dev/null 2>&1; then
|
|
message_id=$(echo "$response" | jq '.result.message_id')
|
|
# else
|
|
# message_id=$(echo "$response" | grep -o '"message_id":[0-9]*' | sed 's/"message_id"://')
|
|
# fi
|
|
|
|
echo "Sent message ID: $message_id"
|
|
echo "TELEGRAM_MESSAGE_ID=$message_id" >> $GITHUB_ENV |