From 8c37d006029a9f30a2a0d577a1ae6b2287e2d80e Mon Sep 17 00:00:00 2001 From: Davte Date: Thu, 16 Jul 2020 10:05:28 +0200 Subject: [PATCH] In default keyboard, show only buttons for commands the user is authorized to call --- davtelepot/__init__.py | 2 +- davtelepot/bot.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index bbc3ab2..539e5ee 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -11,7 +11,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.6.7" +__version__ = "2.6.8" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/bot.py b/davtelepot/bot.py index 31c57f5..ef648e5 100644 --- a/davtelepot/bot.py +++ b/davtelepot/bot.py @@ -501,6 +501,11 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject): ) for command, element in self.commands.items() if 'reply_keyboard_button' in element + and self.authorization_function( + update=update, + user_record=user_record, + authorization_level=element['authorization_level'] + ) ] if len(buttons) == 0: return