diff --git a/HSMensaW_botA.py b/HSMensaW_botA.py index 4a8fa83..0da423c 100644 --- a/HSMensaW_botA.py +++ b/HSMensaW_botA.py @@ -4,7 +4,8 @@ # since 3.5: type hints # def ( : -import asyncio # write concurrent code (not threading. not multiprocessing) +import asyncio +# write concurrent code (not threading. not multiprocessing) # it's cooperative multitasking, no parallelism # coroutines: suspend execution before return and pass control to another coroutine # use await only in async functions @@ -34,13 +35,34 @@ from telepot.namedtuple import InlineKeyboardMarkup, InlineKeyboardButton class Essen: - """ Test Docstring """ - def __init__(self, name, preis, kategorie): + """Class which represents a Essen-Object""" + def __init__(self, name, preis, kategorie) -> None: + """ + Initialize a Essen-Object with given values + + Parameters: + name (string): name of the meal + preis (float): price of the meal + kategorie (string): category of the meal + + Returns: + None + """ self.name = name self.preis = preis self.kategorie = kategorie + return None - def __str__(self): + def __str__(self) -> str: + """ + Formats the attribute of the Essen-Object to a string + + Parameters: + None + + Returns: + _ (string): formatted String of attributes + """ if self.preis > 0: return str("*%s*: `%s` (%.2f €)" % (self.kategorie, self.name, self.preis)) else: @@ -54,25 +76,31 @@ class Language(Enum): config_filename = "config.json" -info_str = "*Inoffizieller Mensa-Bot der Hochschule Mittweida*\nDieser Bot versendet jeden Tag um 10 Uhr den aktuellen " \ - "Mensa-Speiseplan. Er wird über /start für den aktuellen Chat oder die aktuelle Gruppe gestartet, " \ - "/stop beendet ihn wieder. Mit /essen, /mensa und /speiseplan (optional gefolgt von _en_ oder _de_) kann " \ - "der aktuelle Speiseplan manuell abgerufen werden. Mit /settings kann (von Gruppenadmins) die Sprache " \ - "verändert werden.\n\n_Haftungsausschluss: Dieser Bot steht in keiner Verbindung mit der Hochschule " \ - "Mittweida oder dem Studentenwerk Freiberg. Alle Angaben ohne Gewähr._\n\nGrafik bereitgestellt von [" \ - "vecteezy.com](https://de.vecteezy.com) " -var_corona_msg_de = """Bitte halten Sie sich an die AHA-Regeln in der Mensa und achten sie auf die +var_corona_msg_de = """ +Bitte halten Sie sich an die AHA-Regeln in der Mensa und achten sie auf die vorgegebenen Markierung und Hinweise. Den aktuellen Corona-Status an der HS Mittweida können Sie an der [Corona-Ampel](https://www.hs-mittweida.de/) oder im [Corona-Newsticker] (https://www.hs-mittweida.de/index.php?id=247957) der Hochschule einsehen. Nur *ZUSAMMEN* bewirken wir etwas und bewätigen die Pandemie. Bleiben Sie gesund.""" -var_corona_msg_eng = """Please follow the AHA rules in the cafeteria and pay attention to the given markings +var_corona_msg_eng = """ +Please follow the AHA rules in the cafeteria and pay attention to the given markings and instructions. You can see the current Corona status of HS Mittweida at the [Corona traffic light](https://www.hs-mittweida.de/) or in the [Corona news ticker] (https://www.hs-mittweida.de/index.php?id=247957) of the university. Only *TOGETHER* we make a difference and overcome the pandemic. Stay healthy.""" + +info_str = """ +*Inoffizieller Mensa-Bot der Hochschule Mittweida*\nDieser Bot versendet jeden Tag um 10 Uhr den aktuellen +Mensa-Speiseplan. Er wird über /start für den aktuellen Chat oder die aktuelle Gruppe gestartet, +/stop beendet ihn wieder. Mit /essen, /mensa und /speiseplan (optional gefolgt von _en_ oder _de_) kann +der aktuelle Speiseplan manuell abgerufen werden. Mit /settings kann (von Gruppenadmins) die Sprache +verändert werden.\n\n_Haftungsausschluss: Dieser Bot steht in keiner Verbindung mit der Hochschule +Mittweida oder dem Studentenwerk Freiberg. Alle Angaben ohne Gewähr._\n\nGrafik bereitgestellt von +[vecteezy.com](https://de.vecteezy.com) +""" + status = "" essen = [] essen_eng = [] @@ -439,8 +467,6 @@ def process_json(d): return d -print(var_corona_msg_de) -print(var_corona_msg_eng) sys.stdout = open("out.log", "a") sys.stderr = open("err.log", "a") message_log = open("msg.log", "a")