From 1b2cf1d7ed61eba1929c2ec84e25900ec21c7c7a Mon Sep 17 00:00:00 2001 From: angerstoner Date: Mon, 2 Apr 2018 02:29:48 +0200 Subject: [PATCH] random kittens! --- schneiderbot.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/schneiderbot.py b/schneiderbot.py index 382a476..8d95899 100644 --- a/schneiderbot.py +++ b/schneiderbot.py @@ -4,9 +4,11 @@ from telegram.ext import Updater, CommandHandler, MessageHandler, Filters from telegram import ParseMode import logging +import os import random import requests import datetime +import cat MENSA_URL = { "zentral": "zentralmensa", @@ -123,10 +125,11 @@ def help(bot, update): /help - this help text""", parse_mode=ParseMode.MARKDOWN) -def cat(bot, update): +def ccat(bot, update): """CUTE""" - bot.send_photo(chat_id=update.message.chat_id, photo='http://78.media.tumblr.com/tumblr_lxqp5pDJuv1qejbiro1_1280.jpg') - + catfile = cat.getCat(); + bot.send_photo(chat_id=update.message.chat_id, photo=open(catfile, 'rb')) + os.remove(catfile) def magie(bot, update): """MAGIEEEEEE""" @@ -206,7 +209,7 @@ 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", cat)) + dp.add_handler(CommandHandler("cat", ccat)) # log all errors