Skip to content

Instantly share code, notes, and snippets.

@HelloKS
Created June 26, 2016 02:51
Show Gist options
  • Save HelloKS/8d90f29ef4690762506ba39583ebb614 to your computer and use it in GitHub Desktop.
Save HelloKS/8d90f29ef4690762506ba39583ebb614 to your computer and use it in GitHub Desktop.
Telegram alert for deluge execute plugin
#!/bin/sh
# Telegram alert for deluge execute plugin
TORRENT_ID=$1
TORRENT_NAME=$2
TORRENT_PATH=$3
TOKEN='Your Telegram token ID here'
URL='https://api.telegram.org/bot'$TOKEN
MSG_URL=$URL'/sendMessage'
TG_ID="Your Telegram user ID here (numberic 8 digit)"
RST_URL=$MSG_URL$TG_ID
TEMPLATE="[Download Finished] Just finished downloading $TORRENT_NAME."
# Function for send Telegram message to user
function send_message {
curl --silent -output /dev/null \
--data-urlencode "chat_id=${TG_ID}" \
--data-urlencode "text=${TEMPLATE}" \
$MSG_URL
}
send_message
@HelloKS
Copy link
Author

HelloKS commented Jun 26, 2016

Need proper permission (chmod +x tg.sh), curl installed on system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment