Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pyrogram/types/bots_and_keyboards/inline_keyboard_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def __init__(
callback_game: Optional["types.CallbackGame"] = None,
requires_password: Optional[bool] = None,
copy_text: Optional[str] = None
icon_custom_emoji_id: Optional[str] = None
):
super().__init__()

Expand All @@ -106,6 +107,7 @@ def __init__(
self.requires_password = requires_password
# self.pay = pay
self.copy_text = copy_text
self.icon_custom_emoji_id = icon_custom_emoji_id

@staticmethod
def read(b: "raw.base.KeyboardButton"):
Expand Down Expand Up @@ -181,11 +183,17 @@ async def write(self, client: "pyrogram.Client"):
# Telegram only wants bytes, but we are allowed to pass strings too, for convenience.
data = bytes(self.callback_data, "utf-8") if isinstance(self.callback_data, str) else self.callback_data

return raw.types.KeyboardButtonCallback(
btn = raw.types.KeyboardButtonCallback(
text=self.text,
data=data,
requires_password=self.requires_password
)

if self.icon_custom_emoji_id:
btn.icon_custom_emoji_id = self.icon_custom_emoji_id

return btn


if self.url is not None:
return raw.types.KeyboardButtonUrl(
Expand Down