Source code for pyrobale.objects.replykeyboardmarkup
from typing import TYPE_CHECKING, Union
if TYPE_CHECKING:
from .webappinfo import WebAppInfo
from .copytextbutton import CopyTextButton
[docs]
class ReplyKeyboardMarkup:
"""
Represents a reply keyboard.
Attributes:
Each dictionary contains the following keys:
- keyboard (list): A list of lists of dictionaries representing the buttons in the keyboard.
- text (str): The text of the button.
- request_contact (bool, optional): If True, the user's phone number will be sent.
- request_location (bool, optional): If True, the user's location will be sent.
- web_app (WebApp, optional): The web app associated with the button.
"""
def __init__(self):
[docs]
def add_row(self):
"""Add a new row for buttons."""
self.keyboard.append([])
return self
@property
[docs]
def json(self):
return {"keyboard": self.keyboard}
[docs]
def __str__(self):
return str(self.json)