Remove callback parameter from custom.Button

Its behaviour was strange. Removing and adding an event
handler every time a message is sent is not a good idea
and it would just do more harm than good.
This commit is contained in:
Lonami Exo
2018-10-05 20:53:32 +02:00
parent 3dd8b7c6d1
commit 67be6418b6
2 changed files with 33 additions and 52 deletions

View File

@@ -37,23 +37,12 @@ class ButtonMethods(UpdateMethods):
for row in buttons:
current = []
for button in row:
if isinstance(button, custom.MessageButton):
button = button.button
inline = custom.Button._is_inline(button)
is_inline |= inline
is_normal |= not inline
if isinstance(button, custom.Button):
if button.callback:
self.remove_event_handler(
button.callback, events.CallbackQuery)
self.add_event_handler(
button.callback,
events.CallbackQuery(data=getattr(
button.button, 'data', None))
)
button = button.button
elif isinstance(button, custom.MessageButton):
button = button.button
if button.SUBCLASS_OF_ID == 0xbad74a3:
# 0xbad74a3 == crc32(b'KeyboardButton')