ptgb
A complete Telegram Bot API client for Dart

Editing & Deleting Messages

Part of the API Reference.

editMessageText

Future<dynamic> editMessageText(
    String text, {
    String? businessConnectionId,
    Object? chatId,
    int? messageId,
    String? inlineMessageId,
    ParseMode? parseMode,
    List<Json>? entities,
    LinkPreviewOptions? linkPreviewOptions,
    InlineKeyboardMarkup? replyMarkup,
  }) =>

Edits the text of a previously sent message. Provide [chatId] and [messageId] for bot-sent messages, or [inlineMessageId] when editing a message that came from an inline query result.

editMessageCaption

Future<dynamic> editMessageCaption({
    String? businessConnectionId,
    Object? chatId,
    int? messageId,
    String? inlineMessageId,
    String? caption,
    ParseMode? parseMode,
    List<Json>? captionEntities,
    bool? showCaptionAboveMedia,
    InlineKeyboardMarkup? replyMarkup,
  }) =>

Edits the caption of a message that has media attached.

editMessageMedia

Future<dynamic> editMessageMedia(
    InputMedia media, {
    String? businessConnectionId,
    Object? chatId,
    int? messageId,
    String? inlineMessageId,
    InlineKeyboardMarkup? replyMarkup,
  }) async {

Replaces the media (photo/video/etc) of an existing message with [media].

editMessageLiveLocation

Future<dynamic> editMessageLiveLocation(
    double latitude,
    double longitude, {
    String? businessConnectionId,
    Object? chatId,
    int? messageId,
    String? inlineMessageId,
    int? livePeriod,
    double? horizontalAccuracy,
    int? heading,
    int? proximityAlertRadius,
    InlineKeyboardMarkup? replyMarkup,
  }) =>

Updates the coordinates of an in-progress live location started with [sendLocation]’s livePeriod.

stopMessageLiveLocation

Future<dynamic> stopMessageLiveLocation({
    String? businessConnectionId,
    Object? chatId,
    int? messageId,
    String? inlineMessageId,
    InlineKeyboardMarkup? replyMarkup,
  }) =>

Stops updating a live location before its livePeriod naturally expires.

editMessageReplyMarkup

Future<dynamic> editMessageReplyMarkup({
    String? businessConnectionId,
    Object? chatId,
    int? messageId,
    String? inlineMessageId,
    InlineKeyboardMarkup? replyMarkup,
  }) =>

Replaces just the inline keyboard attached to a message, leaving its content untouched.

deleteMessage

Future<bool> deleteMessage(Object chatId, int messageId) async =>

Deletes a single message. Bots can only delete their own messages in private chats, but have wider delete permissions in groups/channels they admin.

deleteMessages

Future<bool> deleteMessages(Object chatId, List<int> messageIds) async =>

Deletes a batch of messages ([messageIds]) in one call.

editMessageChecklist

Future<Json> editMessageChecklist(
    String businessConnectionId,
    int chatId,
    int messageId,
    InputChecklist checklist, {
    InlineKeyboardMarkup? replyMarkup,
  }) async =>

Edits a checklist previously sent on behalf of a connected business account.

approveSuggestedPost

Future<bool> approveSuggestedPost(
    int chatId,
    int messageId, {
    int? sendDate,
  }) async =>

Approves a suggested post in a channel direct-messages chat. If [sendDate] is omitted, the post is published immediately.

declineSuggestedPost

Future<bool> declineSuggestedPost(
    int chatId,
    int messageId, {
    String? comment,
  }) async =>

Declines a suggested post in a channel direct-messages chat, optionally explaining why via [comment].

editEphemeralMessageText

Future<dynamic> editEphemeralMessageText(
    Object chatId,
    int receiverUserId,
    int ephemeralMessageId,
    String text, {
    String? businessConnectionId,
    ParseMode? parseMode,
    List<Json>? entities,
    LinkPreviewOptions? linkPreviewOptions,
    InlineKeyboardMarkup? replyMarkup,
  }) =>

Edits the text of an ephemeral message (one only visible to a single [receiverUserId], as sent with a receiver_user_id argument to methods like [sendLivePhoto]) previously sent in [chatId].

editEphemeralMessageMedia

Future<dynamic> editEphemeralMessageMedia(
    Object chatId,
    int receiverUserId,
    int ephemeralMessageId,
    InputMedia media, {
    String? businessConnectionId,
    InlineKeyboardMarkup? replyMarkup,
  }) {

Replaces the media of an ephemeral message. See [editEphemeralMessageText].

editEphemeralMessageCaption

Future<dynamic> editEphemeralMessageCaption(
    Object chatId,
    int receiverUserId,
    int ephemeralMessageId, {
    String? businessConnectionId,
    String? caption,
    ParseMode? parseMode,
    List<Json>? captionEntities,
    bool? showCaptionAboveMedia,
    InlineKeyboardMarkup? replyMarkup,
  }) =>

Edits the caption of an ephemeral message. See [editEphemeralMessageText].

editEphemeralMessageReplyMarkup

Future<dynamic> editEphemeralMessageReplyMarkup(
    Object chatId,
    int receiverUserId,
    int ephemeralMessageId, {
    String? businessConnectionId,
    InlineKeyboardMarkup? replyMarkup,
  }) =>

Replaces the inline keyboard of an ephemeral message. See [editEphemeralMessageText].

deleteEphemeralMessage

Future<bool> deleteEphemeralMessage(
    Object chatId,
    int receiverUserId,
    int ephemeralMessageId,
  ) async =>

Deletes an ephemeral message. See [editEphemeralMessageText].