Created Example script python (markdown)
16
Example-script-python.md
Normal file
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)
|
||||||
|
```
|
Reference in New Issue
Block a user