3

I tried to edit message from channel by bot, with this code (from aiogram python library):

await bot.edit_message_caption( bot_id, message.forward_from_message_id, "new_caption", parse_mode=ParseMode.HTML)

but it not work :(

i try also bot.edit_message_text but it work only for messages without media

have you any idea?

tecn603
  • 211
  • 5
  • 14
  • 1
    Struggling on the same question. Read through the docs and seems like it's not possible to add caption/text to mediaGroup and it makes me sad, because it's possible via app itself. :( – marzique Nov 16 '19 at 16:40
  • @DenisTarnavsky you can add a caption to the first Media within that group though. This will then show up as a caption for the whole group. – nyx69 Dec 12 '20 at 02:30

1 Answers1

0

Because it top of stackoverflow question about edit caption add a little explanation.

bot.edit_message_caption( bot_id, message.forward_from_message_id, "new_caption", parse_mode=ParseMode.HTML)

It's not work because the function defenition looks like that.

edit_message_caption(self, chat_id: typing.Union[base.Integer, base.String, None] = None,
                               message_id: typing.Optional[base.Integer] = None,
                               inline_message_id: typing.Optional[base.String] = None,
                               caption: typing.Optional[base.String] = None,
                               parse_mode: typing.Optional[base.String] = None,
                               caption_entities: typing.Optional[typing.List[types.MessageEntity]] = None,
                               reply_markup: typing.Union[types.InlineKeyboardMarkup,
                                                          None] = None) -> types.Message or base.Boolean:

So you need stricly write named argument caption="New caption text".