Created Example script python (markdown)

Hellowlol
2016-01-27 12:48:39 +01:00
parent 67ef34949d
commit 4193f0eb13

16
Example-script-python.md Normal file

@@ -0,0 +1,16 @@
```
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)
```