Browse Source

added diet to bot, waiting for schneider to push

master
angerstoner 7 years ago
parent
commit
1e331efedb
  1. 13
      schneiderbot.py

13
schneiderbot.py

@ -11,6 +11,12 @@ import datetime
import cat
import pydog
DIETS = {
"veggy" : "fleischlos",
"fleisch" : "mit Fleisch",
"fisch" : "mit Fisch/ Meeresfrüchten"
}
WEEKDAYS = {
"montag" : 1,
"dienstag" : 2,
@ -136,11 +142,10 @@ def shrug(bot, update):
"""SHRUG"""
update.message.reply_text("¯\_(ツ)_/¯")
def mensa(bot, update, args):
which = "zentral"
filter_categories = MODES["light"]
diet = ""
today = datetime.datetime.now().date().weekday() + 1
if datetime.datetime.now().time() > datetime.time(hour=16):
# Es ist zu spät am Tag, zeig das essen für morgen an
@ -155,6 +160,8 @@ def mensa(bot, update, args):
filter_categories = MODES[arg]
elif arg in WEEKDAYS:
today = WEEKDAYS[arg]
elif arg in DIETS:
diet = DIETS[arg]
else:
update.message.reply_text("Falscher Aufruf! RTFM und versuchs nochmal.")
return
@ -168,7 +175,7 @@ def mensa(bot, update, args):
if len(data["meals"]) > 1:
for meal in data["meals"]:
if meal["category"] not in filter_categories:
if meal["category"] not in filter_categories and diet in meal["diet"]:
meal_line = "*%s*\n" % meal["category"]
meal_line += meal["title"].strip() + "\n"

Loading…
Cancel
Save