Skip to content

ReplyKeyboard

Class

Reply keyboard with full Pyrogram integration and customization options.

Constructor

ReplyKeyboard(
    row_width: int = 3,
    is_persistent: bool | None = None,
    resize_keyboard: bool | None = None,
    one_time_keyboard: bool | None = None,
    selective: bool | None = None,
    placeholder: str | None = None,
)
Parameter Type Default Description
row_width int 3 Buttons per row
is_persistent bool \| None None Keep keyboard visible
resize_keyboard bool \| None None Resize to fit content
one_time_keyboard bool \| None None Hide after one use
selective bool \| None None Show only to specific users
placeholder str \| None None Input field placeholder text

Raises

ConfigurationError — if row_width < 1


Methods

add method

Add buttons in rows based on row_width.

keyboard.add(*buttons)
Usage
from pykeyboard import ReplyKeyboard, ReplyButton

kb = ReplyKeyboard(row_width=2, resize_keyboard=True)
kb.add(
    ReplyButton("📞 Share Contact", request_contact=True),
    ReplyButton("📍 Share Location", request_location=True),
)

row method

Add a single explicit row of buttons (ignores row_width).

keyboard.row(*buttons)

Properties

pyrogram_markup property

Get the Pyrogram ReplyKeyboardMarkup for use with reply_markup=.

Returns: ReplyKeyboardMarkup


PyReplyKeyboardRemove Class

Remove reply keyboard markup.

PyReplyKeyboardRemove(selective: bool | None = None)
Method Returns Description
to_pyrogram() ReplyKeyboardRemove Pyrogram-compatible markup
Usage
from pykeyboard import PyReplyKeyboardRemove

await message.reply("Keyboard removed", reply_markup=PyReplyKeyboardRemove())

PyForceReply Class

Force the user to send a reply.

PyForceReply(
    selective: bool | None = None,
    placeholder: str | None = None,
)
Method Returns Description
to_pyrogram() ForceReply Pyrogram-compatible markup
Usage
from pykeyboard import PyForceReply

await message.reply("Your name?", reply_markup=PyForceReply(placeholder="Type here..."))