mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 12:59:46 +00:00
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:
@@ -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')
|
||||
|
Reference in New Issue
Block a user