Last active
June 30, 2016 18:18
-
-
Save JonnyWong16/3591d1fee289daaafeb8 to your computer and use it in GitHub Desktop.
Get notified on Telegram when a user is transcoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Written by pmow/Hellowlol | |
# Upload to Gist by JonnyWong16 | |
# For this video transcode alert script, you should select the script for action types where it would be useful: | |
# Playback Start and Playback Resume, for example. | |
# Under Settings > Notifications > Scripts, set the parameters that should get passed to the script. | |
import sys | |
import requests | |
# sys.argv[1] is the first argument | |
# sys.argv[2] is the second argument etc | |
USERID = '<numeric ID from @IDBot>' | |
KEY= '<the API key from @BotFather>' | |
TIMEOUT= 10 | |
URL = 'https://api.telegram.org/bot$KEY/sendMessage' | |
TEXT = 'Crap, your server is transcoding something: ! Go check on it, noob!' | |
url = URL + chat_id=%s&disable_web_page_preview=1&text=%s % (KEY, TEXT) | |
if sys.argv[1] != 'Direct Play' and sys.arv[1] != 'Copy': | |
requests.get(url, timeout=timeout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment