Browse Source

filter handling, formatting

master
angerstoner 7 years ago
parent
commit
ba9570b671
  1. 62
      schneiderbot.py

62
schneiderbot.py

@ -23,72 +23,36 @@ MENSA_NAME = {
"turm": "Turmmensa"
}
## TODO: rather use filter list, this is bloated; mensa italia missing
CATEGORIES_LIGHT = {
"Eintopf",
"Menü I",
"Menü II",
"Vegan",
"Vegetarisch",
"Grill III",
"Al dente",
"Pasta und Gratins",
"Kartoffeln und Co.",
## Nordmensa:
"Stamm 1 vegetarisch",
"Nordmensa-Fit",
"Stamm 2",
"Stamm 3",
## Turmmensa:
"Turm vegetarisch Kombi",
"Turm 2b",
"Turm 3a",
"Turm Vegan",
"Regionale Linie"
}
CATEGORIES_FULL = {
"Eintopf",
"Menü I",
"Menü II",
"Vegan",
"Vegetarisch",
"Grill III",
HIDE_CATEGORIES_LIGHT = {
"CampusCurry",
"natürlich fit",
"Al dente",
"Pasta und Gratins",
"Fitnesscenter",
"Salatbuffet",
"Studentenfutter",
"Süße Versuchung",
"Süße Spezial Tagesangebot",
"Kartoffeln und Co.",
"Vollwert & Co. Stärke",
"Vollwert & Co. Gemüse",
"Bio-Beilagen",
"Dessertbuffet",
"Last Minute ab 14:30 Uhr",
## Nordmensa:
"Stamm 1 vegetarisch",
"Nordmensa-Fit",
"Stamm 2",
"Stamm 3",
"Salatbuffet/Pastapoint",
"Last Minute ab 13:30 Uhr",
## Turmmensa:
"Turm vegetarisch Kombi",
"Turm 2b",
"Turm 3a",
"Turm Vegan",
"Regionale Linie",
"Beilagen",
"Last Minute ab 14:00Uhr"
}
HIDE_CATEGORIES_FULL = {
"Last Minute ab 14:30 Uhr",
"Last Minute ab 13:30 Uhr",
"Last Minute ab 14:00Uhr"
}
MODES = {
"light" : CATEGORIES_LIGHT,
"full" : CATEGORIES_FULL
"light" : HIDE_CATEGORIES_LIGHT,
"full" : HIDE_CATEGORIES_FULL
}
@ -153,12 +117,12 @@ def manta(bot, update):
def mensa(bot, update, args):
which = "zentral"
categories = CATEGORIES_LIGHT
filter_categories = MODES["light"]
for arg in args:
if arg in MENSA_NAME:
which = args[0]
elif arg in MODES:
categories = MODES[arg]
filter_categories = MODES[arg]
else:
update.message.reply_text("Falscher Aufruf! RTFM und versuchs nochmal.")
return
@ -175,11 +139,11 @@ def mensa(bot, update, args):
request.encoding = 'utf-8'
data = request.json()
message = "Das Essen für %s in der %s \n" % (data["date"], MENSA_NAME[which])
message = "Das Essen für %s in der %s \n\n" % (data["date"], MENSA_NAME[which])
if len(data["meals"]) > 1:
for meal in data["meals"]:
if meal["category"] in categories:
if meal["category"] not in filter_categories:
meal_line = "*%s*\n" % meal["category"]
meal_line += meal["title"].strip() + "\n"

Loading…
Cancel
Save