|
@ -5,9 +5,8 @@ import requests |
|
|
DISABLED_GROUPS = [-1001301570558] |
|
|
DISABLED_GROUPS = [-1001301570558] |
|
|
|
|
|
|
|
|
DIETS = { |
|
|
DIETS = { |
|
|
"veggy": "fleischlos", |
|
|
|
|
|
"fleisch": "mit Fleisch", |
|
|
|
|
|
"fisch": "mit Fisch/Meeresfrüchten" |
|
|
|
|
|
|
|
|
"veggy": ["Vegetarisch", "Vegan"], |
|
|
|
|
|
"vegan": ["Vegan"] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
WEEKDAYS = { |
|
|
WEEKDAYS = { |
|
@ -74,6 +73,7 @@ def mensa(bot, update, args): |
|
|
return |
|
|
return |
|
|
which = "zentral" |
|
|
which = "zentral" |
|
|
filter_categories = MODES["light"] |
|
|
filter_categories = MODES["light"] |
|
|
|
|
|
diet = [""] |
|
|
auto_next_day = True |
|
|
auto_next_day = True |
|
|
today = datetime.datetime.now().date() |
|
|
today = datetime.datetime.now().date() |
|
|
|
|
|
|
|
@ -87,8 +87,8 @@ def mensa(bot, update, args): |
|
|
date_offset = (6 - today.weekday() + WEEKDAYS[arg]) |
|
|
date_offset = (6 - today.weekday() + WEEKDAYS[arg]) |
|
|
today += datetime.timedelta(days=date_offset) |
|
|
today += datetime.timedelta(days=date_offset) |
|
|
auto_next_day = False |
|
|
auto_next_day = False |
|
|
# elif arg in DIETS: |
|
|
|
|
|
# diet = DIETS[arg] |
|
|
|
|
|
|
|
|
elif arg in DIETS: |
|
|
|
|
|
diet = DIETS[arg] |
|
|
else: |
|
|
else: |
|
|
update.message.reply_text("Falscher Aufruf! RTFM und versuchs nochmal.") |
|
|
update.message.reply_text("Falscher Aufruf! RTFM und versuchs nochmal.") |
|
|
return |
|
|
return |
|
@ -111,9 +111,14 @@ def mensa(bot, update, args): |
|
|
else: |
|
|
else: |
|
|
message = "Das Essen für %s in der %s \n\n" % (today_data["date"], MENSA_NAME[which]) |
|
|
message = "Das Essen für %s in der %s \n\n" % (today_data["date"], MENSA_NAME[which]) |
|
|
for cat in today_data['categories']: |
|
|
for cat in today_data['categories']: |
|
|
if cat['name'] not in filter_categories: |
|
|
|
|
|
meal_line = "*%s*\n" % cat['name'] |
|
|
|
|
|
for meal in cat['meals']: |
|
|
|
|
|
|
|
|
label = cat['name'] |
|
|
|
|
|
meals = cat['meals'] |
|
|
|
|
|
if label not in filter_categories and ( |
|
|
|
|
|
any(filtered in label for filtered in diet) or |
|
|
|
|
|
[item['name'].replace('\xad', '') for item in meals if |
|
|
|
|
|
any(filtered in item['name'].replace('\xad', '') for filtered in diet)]): # TODO: simplify |
|
|
|
|
|
meal_line = "*%s*\n" % label |
|
|
|
|
|
for meal in meals: |
|
|
meal_line += meal['name'].strip() + "\n" |
|
|
meal_line += meal['name'].strip() + "\n" |
|
|
message += meal_line + '\n' |
|
|
message += meal_line + '\n' |
|
|
|
|
|
|
|
@ -121,6 +126,6 @@ def mensa(bot, update, args): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_data_for_day(day, complete_data): |
|
|
def get_data_for_day(day, complete_data): |
|
|
for date in complete_data['days']: |
|
|
|
|
|
if day.isoformat() == date['iso-date']: |
|
|
|
|
|
return date |
|
|
|
|
|
|
|
|
for data in complete_data['days']: |
|
|
|
|
|
if day.isoformat() == data['iso-date']: |
|
|
|
|
|
return data |