From 38bab810483e70254b8c4e5964d411dcf80cf926 Mon Sep 17 00:00:00 2001 From: klux2 Date: Thu, 10 Oct 2019 13:07:38 +0200 Subject: [PATCH] change of language allowed only for group admins Signed-off-by: klux2 --- HSMensaW_botA.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/HSMensaW_botA.py b/HSMensaW_botA.py index 76703b7..61807f5 100644 --- a/HSMensaW_botA.py +++ b/HSMensaW_botA.py @@ -180,6 +180,15 @@ class HSMensaW(telepot.aio.helper.ChatHandler): lang = query_data[:query_data.index("::")] chat_id = int(query_data[query_data.index("::") + 2:]) + chat_member = await bot.getChatMember(chat_id=chat_id, user_id=from_id) + member_status = chat_member["status"] + + if msg["message"]["chat"]["type"] != "private" and member_status != "creator" and \ + member_status != "administrator": + await bot.answerCallbackQuery(callback_query_id=query_id, text="Keine Berechtigung. Bitten Sie einen " + "Admin, die Sprache zu ändern.") + return + name = "" user_id = msg["from"]["id"] if "first_name" in msg["from"].keys():