Browse Source

added requirements.txt, added dog command

quotes
angerstoner 7 years ago
parent
commit
967bcc50e9
  1. 5
      requirements.txt
  2. 14
      schneiderbot.py

5
requirements.txt

@ -0,0 +1,5 @@
python-telegram-bot
telegram
requests
random-cat
git+git://github.com/xNinjaKittyx/pydog.git#egg=pydog

14
schneiderbot.py

@ -9,6 +9,7 @@ import random
import requests import requests
import datetime import datetime
import cat import cat
import pydog
MENSA_URL = { MENSA_URL = {
"zentral": "zentralmensa", "zentral": "zentralmensa",
@ -121,17 +122,25 @@ def help(bot, update):
*Fun*: *Fun*:
/cat - random cat (using thecatapi.com) /cat - random cat (using thecatapi.com)
/dog - random dog (https://dog.ceo/dog-api)
/magie - random Axel Stoll qoute /magie - random Axel Stoll qoute
/manta - random Opel Manta joke /manta - random Opel Manta joke
/help - this help text""", parse_mode=ParseMode.MARKDOWN) /help - this help text""", parse_mode=ParseMode.MARKDOWN)
def ccat(bot, update):
def sendCat(bot, update):
"""CUTE""" """CUTE"""
catfile = cat.getCat(); catfile = cat.getCat();
bot.send_photo(chat_id=update.message.chat_id, photo=open(catfile, 'rb')) bot.send_photo(chat_id=update.message.chat_id, photo=open(catfile, 'rb'))
os.remove(catfile) 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): def magie(bot, update):
"""MAGIEEEEEE""" """MAGIEEEEEE"""
rand = random.SystemRandom() rand = random.SystemRandom()
@ -210,7 +219,8 @@ def main():
dp.add_handler(CommandHandler("magie", magie)) dp.add_handler(CommandHandler("magie", magie))
dp.add_handler(CommandHandler("manta", manta)) dp.add_handler(CommandHandler("manta", manta))
dp.add_handler(CommandHandler("mensa", mensa, pass_args=True)) 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 # log all errors

Loading…
Cancel
Save