Files
telegram-bot/sendMessage
Kirill Chikalin cf3a6e7b06 fix
2025-03-20 08:17:19 +03:00

18 lines
544 B
Bash
Executable File

#!/bin/bash
MESSAGE=$(echo -e "$3")
response=$(curl -s -X POST "https://api.telegram.org/bot$1/sendMessage" \
-d "chat_id=$2" \
-d "parse_mode=MarkdownV2" \
-d "link_preview_options={\"is_disabled\":true}" \
-d "text=$(echo -e "$3")")
# 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