From 967bcc50e9d6e1bc47402401cae65f083ec27f2c Mon Sep 17 00:00:00 2001 From: angerstoner Date: Mon, 2 Apr 2018 12:25:33 +0200 Subject: [PATCH] added requirements.txt, added dog command --- requirements.txt | 5 +++++ schneiderbot.py | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bc12aa3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +python-telegram-bot +telegram +requests +random-cat +git+git://github.com/xNinjaKittyx/pydog.git#egg=pydog diff --git a/schneiderbot.py b/schneiderbot.py index 1b0390f..5eb18cd 100644 --- a/schneiderbot.py +++ b/schneiderbot.py @@ -9,6 +9,7 @@ import random import requests import datetime import cat +import pydog MENSA_URL = { "zentral": "zentralmensa", @@ -121,17 +122,25 @@ def help(bot, update): *Fun*: /cat - random cat (using thecatapi.com) +/dog - random dog (https://dog.ceo/dog-api) /magie - random Axel Stoll qoute /manta - random Opel Manta joke /help - this help text""", parse_mode=ParseMode.MARKDOWN) -def ccat(bot, update): +def sendCat(bot, update): """CUTE""" catfile = cat.getCat(); bot.send_photo(chat_id=update.message.chat_id, photo=open(catfile, 'rb')) os.remove(catfile) + +def sendDog(bot, update): + """CUTE 2.0""" + dog = pydog.PyDog() + bot.send_photo(chat_id=update.message.chat_id, photo=dog.get_random_image()) + + def magie(bot, update): """MAGIEEEEEE""" rand = random.SystemRandom() @@ -210,7 +219,8 @@ def main(): dp.add_handler(CommandHandler("magie", magie)) dp.add_handler(CommandHandler("manta", manta)) dp.add_handler(CommandHandler("mensa", mensa, pass_args=True)) - dp.add_handler(CommandHandler("cat", ccat)) + dp.add_handler(CommandHandler("cat", sendCat)) + dp.add_handler(CommandHandler("dog", sendDog)) # log all errors