|
@ -3,21 +3,19 @@ from telegram import ParseMode, Update |
|
|
import requests |
|
|
import requests |
|
|
from telegram.ext import CallbackContext |
|
|
from telegram.ext import CallbackContext |
|
|
|
|
|
|
|
|
DISABLED_GROUPS = [-1001301570558] |
|
|
|
|
|
|
|
|
|
|
|
DIETS = { |
|
|
DIETS = { |
|
|
"veggy": ["Vegetarisch", "Vegan"], |
|
|
"veggy": ["Vegetarisch", "Vegan"], |
|
|
"vegan": ["Vegan"] |
|
|
"vegan": ["Vegan"] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
WEEKDAYS = { |
|
|
WEEKDAYS = { |
|
|
"montag": 1, |
|
|
|
|
|
"dienstag": 2, |
|
|
|
|
|
"mittwoch": 3, |
|
|
|
|
|
"donnerstag": 4, |
|
|
|
|
|
"freitag": 5, |
|
|
|
|
|
"samstag": 6, |
|
|
|
|
|
"sonntag": 7 |
|
|
|
|
|
|
|
|
"montag": 0, |
|
|
|
|
|
"dienstag": 1, |
|
|
|
|
|
"mittwoch": 2, |
|
|
|
|
|
"donnerstag": 3, |
|
|
|
|
|
"freitag": 4, |
|
|
|
|
|
"samstag": 5, |
|
|
|
|
|
"sonntag": 6 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MENSA_URL = { |
|
|
MENSA_URL = { |
|
@ -77,8 +75,6 @@ def linux_mensa(update: Update, context: CallbackContext): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def mensa(update: Update, context: CallbackContext): |
|
|
def mensa(update: Update, context: CallbackContext): |
|
|
if update.message.chat_id in DISABLED_GROUPS: |
|
|
|
|
|
return |
|
|
|
|
|
which = "zentral" |
|
|
which = "zentral" |
|
|
filter_categories = MODES["light"] |
|
|
filter_categories = MODES["light"] |
|
|
diet = [""] |
|
|
diet = [""] |
|
@ -92,8 +88,13 @@ def mensa(update: Update, context: CallbackContext): |
|
|
elif arg in MODES: |
|
|
elif arg in MODES: |
|
|
filter_categories = MODES[arg] |
|
|
filter_categories = MODES[arg] |
|
|
elif arg in WEEKDAYS: |
|
|
elif arg in WEEKDAYS: |
|
|
date_offset = (6 - today.weekday() + WEEKDAYS[arg]) |
|
|
|
|
|
today += datetime.timedelta(days=date_offset) |
|
|
|
|
|
|
|
|
day = WEEKDAYS[arg] |
|
|
|
|
|
offset = 0 |
|
|
|
|
|
if day > today.weekday(): |
|
|
|
|
|
offset = day - today.weekday() |
|
|
|
|
|
elif day < today.weekday(): |
|
|
|
|
|
offset = (7 - today.weekday() + WEEKDAYS[arg]) |
|
|
|
|
|
today += datetime.timedelta(days=offset) |
|
|
auto_next_day = False |
|
|
auto_next_day = False |
|
|
elif arg in DIETS: |
|
|
elif arg in DIETS: |
|
|
diet = DIETS[arg] |
|
|
diet = DIETS[arg] |
|
|