referencing to user by its id

Signed-off-by: klux2 <k.lux.gm@gmail.com>
This commit is contained in:
klux2 2019-10-09 10:14:58 +02:00
parent 337d4d15f8
commit cb8d23e4f5

View file

@ -181,14 +181,14 @@ class HSMensaW(telepot.aio.helper.ChatHandler):
chat_id = int(query_data[query_data.index("::") + 2:]) chat_id = int(query_data[query_data.index("::") + 2:])
name = "" name = ""
user_id = msg["from"]["id"]
if "first_name" in msg["from"].keys(): if "first_name" in msg["from"].keys():
name = msg["from"]["first_name"] + " " name = msg["from"]["first_name"] + " "
if "last_name" in msg["from"].keys(): if "last_name" in msg["from"].keys():
name += msg["from"]["last_name"] name += msg["from"]["last_name"]
if len(name) > 0: if len(name) == 0:
msg = name + " hat die Sprache geändert nach " name = "User " + user_id
else: msg = "[" + name + "](tg://user?id=" + str(user_id) + ") hat die Sprache geändert nach "
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:
@ -407,8 +407,8 @@ def process_json(d):
return d return d
sys.stdout = open("out.log", "a") # sys.stdout = open("out.log", "a")
sys.stderr = open("err.log", "a") # sys.stderr = open("err.log", "a")
message_log = open("msg.log", "a") message_log = open("msg.log", "a")
signal.signal(signal.SIGTERM, shutdown) signal.signal(signal.SIGTERM, shutdown)
signal.signal(signal.SIGINT, shutdown) signal.signal(signal.SIGINT, shutdown)