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
| Parameter | Type | Default | Description |
|---|---|---|---|
row_width | int | 3 | Max buttons per row |
resize_keyboard | bool | False | Resize to fit buttons |
one_time_keyboard | bool | False | Hide after first tap |
selective | bool | False | Show to mentioned users only |
input_field_placeholder | str | None | Placeholder in the input field |
Removing the Keyboard
from pyrogram.types import ReplyKeyboardRemove
await message.reply("Keyboard removed.", reply_markup=ReplyKeyboardRemove())