Updating messages

editEphemeralMessageText()

Use this method to edit an ephemeral text or rich message. Note that it is not guaranteed that the user will receive the message edit event, especially if they are offline. On success, True is returned.

parameters

parametertyperequireddescription
chat_idnumber | stringrequiredUnique identifier for the target chat or username of the target supergroup in the format @username
receiver_user_idnumberrequiredIdentifier of the user who received the message
ephemeral_message_idnumberrequiredIdentifier of the ephemeral message to edit
textstringoptionalNew text of the message, 1-4096 characters after entity parsing; required if rich_message isn't specified
parse_modestringoptionalMode for parsing entities in the message text. See formatting options for more details.
entitiesMessageEntity[]optionalA JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
rich_messageInputRichMessageoptionalNew rich content of the message; required if text isn't specified
link_preview_optionsLinkPreviewOptionsoptionalLink preview generation options for the message
reply_markupInlineKeyboardMarkupoptionalA JSON-serialized object for an inline keyboard

returns

boolean

usage in yaebal

editEphemeralMessageText is directly typed on Api — call it straight off bot.api.

bot.ts
import type { EditEphemeralMessageTextParams } from "@yaebal/types";

await bot.api.editEphemeralMessageText({
  chat_id: 123456789,
  receiver_user_id: 1,
  ephemeral_message_id: 1,
} satisfies EditEphemeralMessageTextParams);

context shortcut

also available as ctx.editEphemeralMessageText() on 17 context types — see @yaebal/contexts.

context shortcut
/** Use this method to edit an ephemeral text or rich message. Note that it is not guaranteed that the user will receive the message edit event, especially if they are offline. On success, *True* is returned. */
ctx.editEphemeralMessageText(params: Omit<EditEphemeralMessageTextParams, "chat_id">)