Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3.6
- import requests
- import random
- import sys
- if random.randint(1, 10) != 9:
- sys.exit()
- KEY = "742085233:AAGQw7HDVLSYNC2lmDg_rjTgTRDy339-bNM"
- #CHAT = "96378817"
- CHAT = "-1001059274286"
- JOKE_IDS = (1, 2, 3, 4, 5, 6, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16)
- def call(method, **params):
- url = f"https://api.telegram.org/bot{KEY}/{method}"
- r = requests.get(url, params=params)
- return r
- def joke():
- joke_id = random.choice(JOKE_IDS)
- r = requests.get(f"http://rzhunemogu.ru/RandJSON.aspx?CType={joke_id}")
- text = r.text.replace('{"content":"', "").replace('"}', "")
- return text
- text = joke()
- print(call("sendMessage", chat_id=CHAT, text=text).text)
Advertisement
Add Comment
Please, Sign In to add comment