send telegram message
This commit is contained in:
18
sendMessage
Executable file
18
sendMessage
Executable file
@@ -0,0 +1,18 @@
|
||||
+-#!/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
|
||||
Reference in New Issue
Block a user