mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 03:13:45 +03:00
Actually add callbacks registered through Button
This commit is contained in:
parent
f6c45dcc63
commit
a3d6baf408
|
@ -1,6 +1,6 @@
|
||||||
from .updates import UpdateMethods
|
from .updates import UpdateMethods
|
||||||
from ..tl import types, custom
|
from ..tl import types, custom
|
||||||
from .. import utils
|
from .. import utils, events
|
||||||
|
|
||||||
|
|
||||||
class ButtonMethods(UpdateMethods):
|
class ButtonMethods(UpdateMethods):
|
||||||
|
@ -30,7 +30,12 @@ class ButtonMethods(UpdateMethods):
|
||||||
is_inline |= inline
|
is_inline |= inline
|
||||||
is_normal |= not inline
|
is_normal |= not inline
|
||||||
if isinstance(button, custom.Button):
|
if isinstance(button, custom.Button):
|
||||||
# TODO actually register callbacks
|
if button.callback:
|
||||||
|
self.add_event_handler(
|
||||||
|
button.callback,
|
||||||
|
events.CallbackQuery(data=button.data)
|
||||||
|
)
|
||||||
|
|
||||||
button = button.button
|
button = button.button
|
||||||
|
|
||||||
if button.SUBCLASS_OF_ID == 0xbad74a3:
|
if button.SUBCLASS_OF_ID == 0xbad74a3:
|
||||||
|
|
|
@ -29,6 +29,11 @@ class Button:
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
self.is_inline = self._is_inline(button)
|
self.is_inline = self._is_inline(button)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def data(self):
|
||||||
|
if isinstance(self.button, types.KeyboardButtonCallback):
|
||||||
|
return self.button.data
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _is_inline(cls, button):
|
def _is_inline(cls, button):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user