From 83adbc980847a3eaac5f0718ffcc34f574f21cea Mon Sep 17 00:00:00 2001 From: Konrad Date: Fri, 27 Sep 2019 20:51:34 +0200 Subject: [PATCH] requiring user to start the bot to change the language now Signed-off-by: Konrad --- HSMensaW_botA.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/HSMensaW_botA.py b/HSMensaW_botA.py index cb35e54..c036b33 100644 --- a/HSMensaW_botA.py +++ b/HSMensaW_botA.py @@ -3,7 +3,6 @@ import asyncio import datetime import json -import locale import signal import sys import traceback @@ -129,10 +128,13 @@ class HSMensaW(telepot.aio.helper.ChatHandler): await send_message(bot_obj=bot, chat_id=chat_id, msg=info_str, parse_mode="markdown") elif text.startswith("/settings"): - - await send_message(bot_obj=bot, chat_id=chat_id, - msg="Bitte Sprache(n) auswählen/Please select language(s)", - reply_markup=self.keyboard) + if chat_id in ids: + await send_message(bot_obj=bot, chat_id=chat_id, + msg="Bitte Sprache(n) auswählen/Please select language(s)", + reply_markup=self.keyboard) + else: + await send_message(bot_obj=bot, chat_id=chat_id, + msg="Bitte starten Sie zuerst den Bot/Please start the bot first.\n/start") elif text.startswith("/status") and chat_id in config_ids: await send_message(bot_obj=bot, chat_id=chat_id, msg=status, parse_mode="markdown") @@ -376,13 +378,13 @@ def process_json(d): return d -sys.stdout = open("out.log", "a") -sys.stderr = open("err.log", "a") +# sys.stdout = open("out.log", "a") +# sys.stderr = open("err.log", "a") 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') +#locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8') translator = Translator()