|
@ -5,6 +5,7 @@ from telegram.ext import Updater, CommandHandler, MessageHandler, Filters |
|
|
from telegram import ParseMode |
|
|
from telegram import ParseMode |
|
|
from db import Db |
|
|
from db import Db |
|
|
from mensa import mensa |
|
|
from mensa import mensa |
|
|
|
|
|
from coding_love import send_coding_love_gif |
|
|
import logging |
|
|
import logging |
|
|
import random |
|
|
import random |
|
|
import requests |
|
|
import requests |
|
@ -61,13 +62,13 @@ def help(bot, update): |
|
|
/help - this help text""", parse_mode=ParseMode.MARKDOWN) |
|
|
/help - this help text""", parse_mode=ParseMode.MARKDOWN) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sendCat(bot, update): |
|
|
|
|
|
|
|
|
def send_cat(bot, update): |
|
|
"""CUTE""" |
|
|
"""CUTE""" |
|
|
cat_file = requests.get('http://aws.random.cat/meow').json()['file'] |
|
|
cat_file = requests.get('http://aws.random.cat/meow').json()['file'] |
|
|
bot.send_photo(chat_id=update.message.chat_id, photo=cat_file) |
|
|
bot.send_photo(chat_id=update.message.chat_id, photo=cat_file) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sendDog(bot, update): |
|
|
|
|
|
|
|
|
def send_dog(bot, update): |
|
|
"""CUTE 2.0""" |
|
|
"""CUTE 2.0""" |
|
|
dog = pydog.PyDog() |
|
|
dog = pydog.PyDog() |
|
|
bot.send_photo(chat_id=update.message.chat_id, photo=dog.get_random_image()) |
|
|
bot.send_photo(chat_id=update.message.chat_id, photo=dog.get_random_image()) |
|
@ -105,7 +106,7 @@ def revive(bot, update, sudocall=False): |
|
|
update.message.reply_text("You fool! You cannot revive a dead person!") |
|
|
update.message.reply_text("You fool! You cannot revive a dead person!") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SUDOCMDS = { |
|
|
|
|
|
|
|
|
SUDO_CMDS = { |
|
|
"kill": kill, |
|
|
"kill": kill, |
|
|
"revive": revive |
|
|
"revive": revive |
|
|
} |
|
|
} |
|
@ -123,13 +124,13 @@ def sudo(bot, update, args): |
|
|
update.message.reply_text("Unknown command") |
|
|
update.message.reply_text("Unknown command") |
|
|
return |
|
|
return |
|
|
for arg in args: |
|
|
for arg in args: |
|
|
if arg in SUDOCMDS: |
|
|
|
|
|
SUDOCMDS[arg](bot, update, True) |
|
|
|
|
|
|
|
|
if arg in SUDO_CMDS: |
|
|
|
|
|
SUDO_CMDS[arg](bot, update, True) |
|
|
else: |
|
|
else: |
|
|
update.message.reply_text("Unknown command") |
|
|
update.message.reply_text("Unknown command") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def sendCatDog(bot, update): |
|
|
|
|
|
|
|
|
def send_cat_dog(bot, update): |
|
|
"""Best of both worlds!""" |
|
|
"""Best of both worlds!""" |
|
|
catdog = "https://upload.wikimedia.org/wikipedia/en/6/64/CatDog.jpeg" |
|
|
catdog = "https://upload.wikimedia.org/wikipedia/en/6/64/CatDog.jpeg" |
|
|
bot.send_photo(chat_id=update.message.chat_id, photo=catdog) |
|
|
bot.send_photo(chat_id=update.message.chat_id, photo=catdog) |
|
@ -197,14 +198,15 @@ def main(): |
|
|
dp.add_handler(CommandHandler("goodlife", goodlife)) |
|
|
dp.add_handler(CommandHandler("goodlife", goodlife)) |
|
|
dp.add_handler(CommandHandler("mensa", mensa, pass_args=True)) |
|
|
dp.add_handler(CommandHandler("mensa", mensa, pass_args=True)) |
|
|
dp.add_handler(CommandHandler("sudo", sudo, pass_args=True)) |
|
|
dp.add_handler(CommandHandler("sudo", sudo, pass_args=True)) |
|
|
dp.add_handler(CommandHandler("cat", sendCat)) |
|
|
|
|
|
dp.add_handler(CommandHandler("dog", sendDog)) |
|
|
|
|
|
dp.add_handler(CommandHandler("catdog", sendCatDog)) |
|
|
|
|
|
|
|
|
dp.add_handler(CommandHandler("cat", send_cat)) |
|
|
|
|
|
dp.add_handler(CommandHandler("dog", send_dog)) |
|
|
|
|
|
dp.add_handler(CommandHandler("catdog", send_cat_dog)) |
|
|
dp.add_handler(CommandHandler("shrug", shrug)) |
|
|
dp.add_handler(CommandHandler("shrug", shrug)) |
|
|
dp.add_handler(CommandHandler("kill", kill)) |
|
|
dp.add_handler(CommandHandler("kill", kill)) |
|
|
dp.add_handler(CommandHandler("revive", revive)) |
|
|
dp.add_handler(CommandHandler("revive", revive)) |
|
|
dp.add_handler(CommandHandler("simon", simon, pass_args=True)) |
|
|
dp.add_handler(CommandHandler("simon", simon, pass_args=True)) |
|
|
dp.add_handler(CommandHandler("graveyard", graveyard)) |
|
|
dp.add_handler(CommandHandler("graveyard", graveyard)) |
|
|
|
|
|
dp.add_handler(CommandHandler("codinglove", send_coding_love_gif)) |
|
|
|
|
|
|
|
|
# log all errors |
|
|
# log all errors |
|
|
dp.add_error_handler(error) |
|
|
dp.add_error_handler(error) |
|
|