|
|
@ -119,16 +119,19 @@ def mensa(update: Update, context: CallbackContext): |
|
|
|
else: |
|
|
|
message = "Das Essen für %s in der %s \n\n" % (today_data["date"], MENSA_NAME[which]) |
|
|
|
for cat in today_data['categories']: |
|
|
|
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" |
|
|
|
message += meal_line + '\n' |
|
|
|
try: |
|
|
|
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" |
|
|
|
message += meal_line + '\n' |
|
|
|
except: # TODO: catch correct exception |
|
|
|
print("Could not fetch meal. Skipping.") |
|
|
|
|
|
|
|
update.message.reply_text(message, ParseMode.MARKDOWN) |
|
|
|
|
|
|
|