ReplyKeyboardMarkup builder
This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).
build(): TelegramReplyKeyboardMarkup
Return TelegramReplyKeyboardMarkup as object
combine(keyboard: TelegramKeyboardButton[][]
| TelegramReplyKeyboardMarkup
| { toJSON: () => TelegramReplyKeyboardMarkup; }): this
Allows you to combine keyboards. Only keyboards are combined. You need to call the .row()
method to line-break after combine.
Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
persistent(isEnabled?: boolean): this
Requests clients to always show the keyboard when the regular keyboard is hidden. Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
placeholder(value?: string): this
The placeholder to be shown in the input field when the keyboard is active; 1-64 characters
requestChat(text: string,requestId: number,options?: Omit<TelegramKeyboardButtonRequestChat, "request_id" | "chat_is_channel"> & { chat_is_channel?: boolean; },): this
If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only.
requestContact(text: string): this
If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
requestLocation(text: string): this
If True, the user's current location will be sent when the button is pressed. Available in private chats only.
requestPoll(text: string,type?: TelegramKeyboardButtonPollType["type"],): this
If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.
If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
requestUsers(): this
If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only.
!Note Keyboard is resized by default! For disable it you can use .resized(false)
Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard.
Text of the button. It will be sent as a message when the button is pressed
toJSON(): TelegramReplyKeyboardMarkup
Serializing a class into an TelegramReplyKeyboardMarkup object (used by JSON.stringify)
requestChat(text: string,requestId: number,options?: Omit<TelegramKeyboardButtonRequestChat, "request_id" | "chat_is_channel"> & { chat_is_channel?: boolean; },): TelegramKeyboardButton
If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only.
requestContact(text: string): TelegramKeyboardButton
If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
requestLocation(text: string): TelegramKeyboardButton
If True, the user's current location will be sent when the button is pressed. Available in private chats only.
requestPoll(text: string,type?: TelegramKeyboardButtonPollType["type"],): TelegramKeyboardButton
If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.
If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
requestUsers(): TelegramKeyboardButton
If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only.
Text of the button. It will be sent as a message when the button is pressed