From 7d81510fed182109219e2ba63a659f666ed3c469 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 3 Sep 2020 23:15:46 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9E=95=20Add=20non-data=20methods=20to=20reg?= =?UTF-8?q?ister=20and=20unregister=20keyboard=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- royalnet/serf/telegram/telegramserf.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1fb0e4b0..04ad6ff7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "royalnet" -version = "5.11.6" +version = "5.11.8" description = "A multipurpose bot and web framework" authors = ["Stefano Pigozzi "] license = "AGPL-3.0+" diff --git a/royalnet/serf/telegram/telegramserf.py b/royalnet/serf/telegram/telegramserf.py index 6d1ba018..312a1fb0 100644 --- a/royalnet/serf/telegram/telegramserf.py +++ b/royalnet/serf/telegram/telegramserf.py @@ -165,6 +165,12 @@ class TelegramSerf(Serf): 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]: # noinspection PyMethodParameters class TelegramKeyboardData(rc.CommandData):