Skip to content

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.

[Documentation]

Constructors

Constructor

new ForceReplyKeyboard(): ForceReplyKeyboard

Returns

ForceReplyKeyboard

Properties

PropertyTypeDefined in
optionsobjectkeyboards/index.d.ts:620
options.isSelectivebooleankeyboards/index.d.ts:621
options.placeholderstringkeyboards/index.d.ts:622

Methods

build()

build(): TelegramForceReply

Defined in: keyboards/index.d.ts:645

Return TelegramForceReply as JSON

Returns

TelegramForceReply


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

ParameterType
value?string

Returns

this

Example

ts
new Keyboard().placeholder("some text"); // to enable
new Keyboard().placeholder(); // to disable

selective()

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

ParameterType
isEnabled?boolean

Returns

this

Example

ts
new ForceReplyKeyboard().selective(); // to enable
new ForceReplyKeyboard().selective(false); // to disable

toJSON()

toJSON(): TelegramForceReply

Defined in: keyboards/index.d.ts:649

Serializing a class into an TelegramForceReply object (used by JSON.stringify)

Returns

TelegramForceReply