editMessageCaption method
Edits the current message's caption.
Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned.
Parameters:
businessConnectionId
: Unique identifier of the business connectioncaption
: New caption of the message, 0-1024 characters after entities parsingparseMode
: Mode for parsing entities in the message captioncaptionEntities
: List of special entities that appear in the captionshowCaptionAboveMedia
: Pass True, if the caption must be shown above the message mediareplyMarkup
: Additional interface options
Returns the edited Message object.
Throws TeleverseException if no message information is found in the current update.
Example:
// Edit caption
await ctx.editMessageCaption(caption: 'Updated caption');
// Edit with formatting
await ctx.editMessageCaption(
caption: '*Updated caption* with _formatting_',
parseMode: ParseMode.markdownV2,
);
// Show caption above media
await ctx.editMessageCaption(
caption: 'Caption above the photo',
showCaptionAboveMedia: true,
);
Implementation
Future<Message> editMessageCaption({
String? businessConnectionId,
String? caption,
ParseMode? parseMode,
List<MessageEntity>? captionEntities,
bool? showCaptionAboveMedia,
InlineKeyboardMarkup? replyMarkup,
}) async {
final chatId = _getChatId();
final msgId = messageId;
_verifyInfo(
[chatId, msgId],
APIMethod.editMessageCaption,
description:
"No message or chat information found in the current update.",
);
return api.editMessageCaption(
chatId!,
msgId!,
businessConnectionId: _businessConnectionId(businessConnectionId),
caption: caption,
parseMode: parseMode,
captionEntities: captionEntities,
showCaptionAboveMedia: showCaptionAboveMedia,
replyMarkup: replyMarkup,
);
}