1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Add non-data methods to register and unregister keyboard keys

This commit is contained in:
Steffo 2020-09-03 23:15:46 +02:00
parent 014ebc7f51
commit 7d81510fed
2 changed files with 7 additions and 1 deletions

View file

@ -5,7 +5,7 @@
[tool.poetry] [tool.poetry]
name = "royalnet" name = "royalnet"
version = "5.11.6" version = "5.11.8"
description = "A multipurpose bot and web framework" description = "A multipurpose bot and web framework"
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"] authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
license = "AGPL-3.0+" license = "AGPL-3.0+"

View file

@ -165,6 +165,12 @@ class TelegramSerf(Serf):
return TelegramMessageData return TelegramMessageData
def register_keyboard_key(self, identifier: str, key: rc.KeyboardKey, command: rc.Command):
self.key_callbacks[identifier] = TelegramKeyCallback(key=key, command=command)
def unregister_keyboard_key(self, identifier: str):
del self.key_callbacks[identifier]
def callback_data_factory(self) -> Type[rc.CommandData]: def callback_data_factory(self) -> Type[rc.CommandData]:
# noinspection PyMethodParameters # noinspection PyMethodParameters
class TelegramKeyboardData(rc.CommandData): class TelegramKeyboardData(rc.CommandData):