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

Correctly unregister forcestart key in mm

This commit is contained in:
Steffo 2019-09-10 13:51:54 +02:00
parent d907757227
commit 3138250c7f
2 changed files with 5 additions and 2 deletions

View file

@ -50,7 +50,10 @@ class TelegramBot(GenericBot):
interface.keys_callbacks[key_name] = callback interface.keys_callbacks[key_name] = callback
def unregister_keyboard_key(interface, key_name: str): def unregister_keyboard_key(interface, key_name: str):
try:
del interface.keys_callbacks[key_name] del interface.keys_callbacks[key_name]
except KeyError:
raise KeyError(f"Key '{key_name}' is not registered")
return TelegramInterface return TelegramInterface

View file

@ -330,7 +330,7 @@ class MmCommand(Command):
self.interface.unregister_keyboard_key(f"mm_{mmevent.mmid}_r_YES") self.interface.unregister_keyboard_key(f"mm_{mmevent.mmid}_r_YES")
self.interface.unregister_keyboard_key(f"mm_{mmevent.mmid}_r_LATER") self.interface.unregister_keyboard_key(f"mm_{mmevent.mmid}_r_LATER")
self.interface.unregister_keyboard_key(f"mm_{mmevent.mmid}_r_NO") self.interface.unregister_keyboard_key(f"mm_{mmevent.mmid}_r_NO")
self.interface.unregister_keyboard_key(f"mm_{mmevent.mmid}_start") self.interface.unregister_keyboard_key(f"mm_{mmevent.mmid}_forcestart")
def __init__(self, interface): def __init__(self, interface):
super().__init__(interface) super().__init__(interface)