v0.3.x ยท pykeyboard

Reply Keyboard

Build the keyboard that replaces the phone's native keyboard.ReplyKeyboard wraps rows of ReplyButton objects and serialises to pyrogram.types.ReplyKeyboardMarkup.

Basic Usage

from pykeyboard import ReplyKeyboard, ReplyButton

kb = ReplyKeyboard(row_width=2, resize_keyboard=True)
kb.add(
    ReplyButton("๐Ÿ“Š Stats"),
    ReplyButton("โš™๏ธ Settings"),
    ReplyButton("โ“ Help"),
)

await message.reply("Choose:", reply_markup=kb)

Special Buttons

# Request phone number
ReplyButton("Share phone", request_contact=True)

# Request location
ReplyButton("Share location", request_location=True)

# Request a poll
ReplyButton("Create poll", request_poll=True)

ReplyKeyboard Options

ParameterTypeDefaultDescription
row_widthint3Max buttons per row
resize_keyboardboolFalseResize to fit buttons
one_time_keyboardboolFalseHide after first tap
selectiveboolFalseShow to mentioned users only
input_field_placeholderstrNonePlaceholder in the input field

Removing the Keyboard

from pyrogram.types import ReplyKeyboardRemove

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