stating the person who changed the language

This commit is contained in:
klux2@hs-mittweida.de 2019-10-04 16:18:48 +02:00
parent 2c7337f0e0
commit 29220fa2c5

View file

@ -180,13 +180,23 @@ class HSMensaW(telepot.aio.helper.ChatHandler):
lang = query_data[:query_data.index("::")] lang = query_data[:query_data.index("::")]
chat_id = int(query_data[query_data.index("::") + 2:]) chat_id = int(query_data[query_data.index("::") + 2:])
name = ""
if "first_name" in msg["from"].keys():
name = msg["from"]["first_name"] + " "
if "last_name" in msg["from"].keys():
name += msg["from"]["last_name"]
if len(name) > 0:
msg = name + " hat die Sprache geändert nach "
else:
msg = "Sprache geändert nach "
message = "Fehler beim Setzen der Sprache" message = "Fehler beim Setzen der Sprache"
if lang == Language.GERMAN.value: if lang == Language.GERMAN.value:
message = "Sprache geändert nach _deutsch_." message = msg + "_Deutsch_."
elif lang == Language.ENGLISH.value: elif lang == Language.ENGLISH.value:
message = "Changed language to _english_." message = msg + "_English_."
elif lang == Language.GERMAN_ENGLISH.value: elif lang == Language.GERMAN_ENGLISH.value:
message = "Sprache geändert nach _deutsch + englisch_. Changed language to _german + english_." message = msg + "_Deutsch + Englisch_."
if chat_id in ids: if chat_id in ids:
ids[chat_id] = Language(lang) ids[chat_id] = Language(lang)