change of language allowed only for group admins

Signed-off-by: klux2 <k.lux.gm@gmail.com>
This commit is contained in:
klux2 2019-10-10 13:07:38 +02:00
parent ccf6f72539
commit 38bab81048

View file

@ -180,6 +180,15 @@ 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:])
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 = "" name = ""
user_id = msg["from"]["id"] user_id = msg["from"]["id"]
if "first_name" in msg["from"].keys(): if "first_name" in msg["from"].keys():