GramIO API Reference / @gramio/keyboards/dist / ForceReplyKeyboard
Class: ForceReplyKeyboard
Defined in: keyboards/index.d.ts:619
ForceReply builder
Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
Constructors
Constructor
new ForceReplyKeyboard():
ForceReplyKeyboard
Returns
ForceReplyKeyboard
Properties
| Property | Type | Defined in |
|---|---|---|
options | object | keyboards/index.d.ts:620 |
options.isSelective | boolean | keyboards/index.d.ts:621 |
options.placeholder | string | keyboards/index.d.ts:622 |
Methods
build()
build():
TelegramForceReply
Defined in: keyboards/index.d.ts:645
Return TelegramForceReply as JSON
Returns
placeholder()
placeholder(
value?):this
Defined in: keyboards/index.d.ts:641
The placeholder to be shown in the input field when the reply is active; 1-64 characters
Parameters
| Parameter | Type |
|---|---|
value? | string |
Returns
this
Example
new Keyboard().placeholder("some text"); // to enable
new Keyboard().placeholder(); // to disableselective()
selective(
isEnabled?):this
Defined in: keyboards/index.d.ts:632
Use this parameter if you want to force reply from 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.
Parameters
| Parameter | Type |
|---|---|
isEnabled? | boolean |
Returns
this
Example
new ForceReplyKeyboard().selective(); // to enable
new ForceReplyKeyboard().selective(false); // to disabletoJSON()
toJSON():
TelegramForceReply
Defined in: keyboards/index.d.ts:649
Serializing a class into an TelegramForceReply object (used by JSON.stringify)