Commit 585c1ba8 authored by Pietro Albini's avatar Pietro Albini

Allow only chat admins to use the "now" action

parent 44db94cb
......@@ -37,6 +37,9 @@ class CallbackQuery(botogram.objects.base.BaseObject):
"data": str,
"game_short_name": str,
}
replace_keys = {
"from": "sender",
}
botogram.Update.optional["callback_query"] = CallbackQuery
......
......@@ -161,6 +161,16 @@ class PostComponent(botogram.Component):
query = update.callback_query
action, data = query.data.split(":", 1)
if action == "now":
if query.sender not in query.message.chat.admins:
bot.api.call("answerCallbackQuery", {
"callback_query_id": query.id,
"text": "Devi essere admin per poter eseguire questa "
"azione.",
"show_alert": True,
})
return
if action == "toggle":
message, social = data.split(":")
message = int(message)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment