Skip to content

Reply (API Reference)

ts
class Reply<TContext extends Context = Context>

Properties

PropertyTypeDescription
textstring | undefinedMessage text
parseModeParseMode | undefinedParse mode used
entitiesMessageEntity[] | undefinedText entities
buttonsReplyButton[]Inline keyboard buttons (empty if no keyboard)
replyMarkupunknownRaw reply_markup from the payload
chatAnyChat<TContext>Target chat
messageIdnumberSynthetic message ID
rawMessageFull raw Message object
replyingToReply<TContext> | undefinedReferenced earlier reply (if any)
mediaReplyMedia | undefinedMedia type and file ID (if media message)

Methods

clickButton(matcher): Promise<void>

Dispatches a callback query as if the user clicked the button.

ts
// By visible text:
await reply.clickButton('Yes');

// By callback data:
await reply.clickButton({ callbackData: 'answer:yes' });

ReplyButton

ts
interface ReplyButton {
  text: string;
  callbackData?: string;
  url?: string;
  raw: InlineKeyboardButton;
}

ReplyMedia

ts
type MediaType = 'animation' | 'audio' | 'document' | 'photo' | 'sticker' | 'video' | 'video_note' | 'voice';

interface ReplyMedia {
  type: MediaType;
  fileId: string;
}

ReplyClickButtonMatcher

ts
interface ReplyClickButtonMatcher {
  callbackData: string;
}

clickButton accepts either a string (matched against button text) or a ReplyClickButtonMatcher (matched against callbackData).

See also

Released under the MIT License.