from .. import App
from pykeyboard import ReplyKeyboard
from pyrogram import Filters, KeyboardButton
@App.on_message(Filters.command('reply_keyboard'))
def reply_keyboard_command(client, message):
message.reply_text(
'Reply keyboard:\n\n'
'/add_reply_button - add buttons\n'
'/row_reply_button - add button row\n'
)
@App.on_message(Filters.command('add_reply_button'))
def add_reply_button_command(client, message):
keyboard = ReplyKeyboard(row_width=3)
keyboard.add(
KeyboardButton('1', 'reply_keyboard#1'),
KeyboardButton('2', 'reply_keyboard#2'),
KeyboardButton('3', 'reply_keyboard#3'),
KeyboardButton('4', 'reply_keyboard#4'),
KeyboardButton('5', 'reply_keyboard#5'),
)
message.reply_text(
'Add buttons:\n\n'
'keyboard = ReplyKeyboard(row_width=3)
\n'
'keyboard.add(
\n'
" KeyboardButton('1', 'reply_keyboard#1'),
\n"
" KeyboardButton('2', 'reply_keyboard#2'),
\n"
" KeyboardButton('3', 'reply_keyboard#3'),
\n"
" KeyboardButton('4', 'reply_keyboard#4'),
\n"
" KeyboardButton('5', 'reply_keyboard#5'),
\n"
')
\n',
reply_markup=keyboard
)
@App.on_message(Filters.command('row_reply_button'))
def row_reply_button_command(client, message):
keyboard = ReplyKeyboard()
keyboard.row(KeyboardButton('1', 'reply_keyboard#1'))
keyboard.row(
KeyboardButton('2', 'reply_keyboard#2'),
KeyboardButton('3', 'reply_keyboard#3')
)
keyboard.row(KeyboardButton('4', 'reply_keyboard#4'))
keyboard.row(KeyboardButton('5', 'reply_keyboard#5'))
message.reply_text(
'Add button row:\n\n'
"keyboard = ReplyKeyboard()
\n"
"keyboard.row(KeyboardButton('1', 'reply_keyboard#1'))
\n"
"keyboard.row(
\n"
" KeyboardButton('2', 'reply_keyboard#2'),
\n"
" KeyboardButton('3', 'reply_keyboard#3')
\n"
")
\n"
"keyboard.row(KeyboardButton('4', 'reply_keyboard#4'))
\n"
"keyboard.row(KeyboardButton('5', 'reply_keyboard#5'))
\n",
reply_markup=keyboard
)