In default keyboard, show only buttons for commands the user is authorized to call

This commit is contained in:
Davte 2020-07-16 10:05:28 +02:00
parent ada375b766
commit 8c37d00602
2 changed files with 6 additions and 1 deletions

View File

@ -11,7 +11,7 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it" __email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0" __license__ = "GNU General Public License v3.0"
__version__ = "2.6.7" __version__ = "2.6.8"
__maintainer__ = "Davide Testa" __maintainer__ = "Davide Testa"
__contact__ = "t.me/davte" __contact__ = "t.me/davte"

View File

@ -501,6 +501,11 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
) )
for command, element in self.commands.items() for command, element in self.commands.items()
if 'reply_keyboard_button' in element 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: if len(buttons) == 0:
return return