#1970·telegraf

`reply_parameters` doesn't work in `Context.replyWithPhoto`

Author: haruki-nikaidouCreated Mar 10, 2024Updated May 5, 2026

Context

In a typescript + webpack project, using webpack --watch and nodemon to develop.

  • Telegraf.js Version: 4.16.3
  • Node.js Version: 20.11.1
  • Operating System: Kubuntu 23.10 x86_64

Minimal Example Code Reproducing the Issue

typescript
export async function replyAPhoto(ctx: Context) {
    const command_message_id = ctx.message.message_id;
    const photoBuffer = await getPhotoBuffer();
    await ctx.replyWithPhoto({source: photoBuffer}, {
        reply_parameters: { message_id: command_message_id },
    });
}

I have registered that function in /see command. When I send the command, the photo is sent, but not reply.

Expected Behavior

Send the photo and reply my command message

Current Behavior

Send the photo but not reply my command message

Error Message and Logs (export DEBUG='telegraf:*')

  telegraf:main Created a `Telegraf` instance +0ms
Bot is running
  telegraf:main Connecting to Telegram +1ms
  telegraf:client HTTP call getMe {} +0ms
  telegraf:main Launching @mybot +1s
  telegraf:client HTTP call deleteWebhook { drop_pending_updates: undefined } +1s
  telegraf:main Bot started with long polling +298ms
  telegraf:polling Starting long polling +0ms
  telegraf:client HTTP call getUpdates { timeout: 50, offset: 0, allowed_updates: [] } +299ms
  telegraf:main Processing update 306145224 +4s
  telegraf:client HTTP call sendPhoto {
  chat_id: 6152025353,
  photo: {
    source: <Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 02 80 00 00 04 70 08 06 00 00 00 7a 8f e5 00 00 03 30 8f 49 44 41 54 78 01 ec c1 07 80 5e f7 59 ... 209046 more bytes>
  },
  message_thread_id: undefined,
  reply_parameters: { message_id: 88 }
} +4s
  telegraf:main Finished processing update 306145224 +2s
  telegraf:client HTTP call getUpdates { timeout: 50, offset: 306145225, allowed_updates: [] } +2s