replaced month/weekday array with localized string
Signed-off-by: klux2 <k.lux.gm@gmail.com>
This commit is contained in:
parent
739017538d
commit
439ae9f17e
1 changed files with 4 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
|||
import asyncio
|
||||
import datetime
|
||||
import json
|
||||
import locale
|
||||
import signal
|
||||
import sys
|
||||
import traceback
|
||||
|
@ -32,9 +33,6 @@ class Essen:
|
|||
|
||||
|
||||
config_filename = "config.json"
|
||||
monate = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November",
|
||||
"Dezember"]
|
||||
wochentage = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"]
|
||||
info_str = "*Mensa-Bot der Hochschule Mittweida (beta)*\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 kann der aktuelle Speiseplan manuell abgerufen " \
|
||||
|
@ -135,8 +133,7 @@ class HSMensaW(telepot.aio.helper.ChatHandler):
|
|||
|
||||
async def send_essen(chat_id: int) -> None:
|
||||
global datum, essen
|
||||
nachricht = "Speiseplan am %s, den %s:\n" % (wochentage[datum.weekday()], datum.strftime("%d. MONAT %Y"))
|
||||
nachricht = nachricht.replace("MONAT", monate[(datum.month - 1) % 12])
|
||||
nachricht = "Speiseplan am %s:\n" % datum.strftime("%A, den %d. %B %Y")
|
||||
for i in essen:
|
||||
nachricht += "- " + str(i).replace(".", ",") + "\n\n"
|
||||
await send_message(bot_obj=bot, chat_id=chat_id, msg=nachricht, parse_mode="markdown")
|
||||
|
@ -305,6 +302,8 @@ message_log = open("msg.log", "a")
|
|||
signal.signal(signal.SIGTERM, shutdown)
|
||||
signal.signal(signal.SIGINT, shutdown)
|
||||
|
||||
locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8')
|
||||
|
||||
try:
|
||||
with open(config_filename, 'r') as config_file:
|
||||
config = json.load(config_file)
|
||||
|
|
Loading…
Reference in a new issue