Browse Source

fixed formatting and syntax

master
Angerstoner 6 years ago
parent
commit
766fbe7510
  1. 20
      schneiderbot.py

20
schneiderbot.py

@ -90,6 +90,7 @@ with open("manta.txt", "r") as tmp_file:
with open("goodlife.txt", "r") as tmp_file:
GOOD_LIFE = tmp_file.readlines()
# Define a few command handlers. These usually take the two arguments bot and
# update. Error handlers also receive the raised TelegramError object in error.
def start(bot, update):
@ -99,6 +100,7 @@ def start(bot, update):
https://mensa.schneider-hosting.de
Mhmm, lecker. Guten Appetit!""")
def help(bot, update):
"""Send a message when the command /help is issued."""
update.message.reply_text("""Commands:
@ -119,6 +121,7 @@ def help(bot, update):
/graveyard - shows the dead people
/help - this help text""", parse_mode=ParseMode.MARKDOWN)
def sendCat(bot, update):
"""CUTE"""
catfile = cat.getCat();
@ -131,6 +134,7 @@ def sendDog(bot, update):
dog = pydog.PyDog()
bot.send_photo(chat_id=update.message.chat_id, photo=dog.get_random_image())
def kill(bot, update, sudocall=False):
"""kill me pls"""
db = Db()
@ -148,6 +152,7 @@ def kill(bot, update, sudocall = False):
db.kill(user, update.message.chat_id)
update.message.reply_text(message)
def revive(bot, update, sudocall=False):
"""unkill me pls"""
db = Db()
@ -161,16 +166,19 @@ def revive(bot, update, sudocall = False):
return
update.message.reply_text("You fool! You cannot revive a dead person!")
SUDOCMDS = {
"kill": kill,
"revive": revive
}
def graveyard(bot, update):
"""List the dead"""
db = Db()
update.message.reply_text("Here are the dead people:\n%s" % db.get_dead_bodies(update.message.chat_id))
def sudo(bot, update, args):
"""for real"""
if not args:
@ -182,37 +190,44 @@ def sudo(bot, update, args):
else:
update.message.reply_text("Unknown command")
def sendCatDog(bot, update):
"""Best of both worlds!"""
catdog = "https://upload.wikimedia.org/wikipedia/en/6/64/CatDog.jpeg"
bot.send_photo(chat_id=update.message.chat_id, photo=catdog)
def magie(bot, update):
"""MAGIEEEEEE"""
rand = random.SystemRandom()
update.message.reply_text(STOLL[rand.randrange(0, len(STOLL), 1)])
def manta(bot, update):
"""Boah ey, geile Karre!"""
rand = random.SystemRandom()
update.message.reply_text(MANTA[rand.randrange(0, len(MANTA), 1)])
def goodlife(bot, update):
"""GOOD LIFE MY A..."""
rand = random.SystemRandom()
update.message.reply_text(GOOD_LIFE[rand.randrange(0, len(GOOD_LIFE), 1)])
def shrug(bot, update):
"""SHRUG"""
update.message.reply_text("¯\_(ツ)_/¯")
def simon(bot, update, args):
"KAUF DIR N HUND"
name = "[Simon](tg://user?id=47438109)"
if len(args) > 0:
name = " ".join(args[0:]
name = " ".join(args[0:])
update.message.reply_text("%s, bitte kauf dir einen Hund oder eine Katze, du hast zu viel Zeit" % name)
def mensa(bot, update, args):
which = "zentral"
filter_categories = MODES["light"]
@ -296,10 +311,9 @@ def main():
dp.add_handler(CommandHandler("shrug", shrug))
dp.add_handler(CommandHandler("kill", kill))
dp.add_handler(CommandHandler("revive", revive))
dp.add_handler(CommandHandler("simon", simon))
dp.add_handler(CommandHandler("simon", simon, pass_args=True))
dp.add_handler(CommandHandler("graveyard", graveyard))
# log all errors
dp.add_error_handler(error)

Loading…
Cancel
Save