Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you use Telegram Inline keyboards in media groups?

I am reading the documentation, and while .sendMessage() method has reply_markup argument, where you can pass the inline keyboard, media group (album, few files together, etc) doesn't have such an argument.

# example with python-telegram-bot libriary
updater = Updater("token")
button = InlineKeyboardButton("this is a button.", callback_data="woo!")

# this works
updater.bot.sendPhoto("https://google.com/cat.png", reply_markup=InlineKeyboardMarkup([[button]]))

# but this doesn't 
updater.bot.sendMediaGroup(InputMediaPhoto("https://google.com/cat.png"), reply_markup=InlineKeyboardMarkup([[button]]))

Just wanted to make sure that this is actually true, since every other type of message CAN have an inline keyboard.

like image 346
Mikhail Khromov Avatar asked Oct 22 '25 23:10

Mikhail Khromov


1 Answers

Media groups can't have a reply markup. Neither the send_media_group method nor the InputMedia* classes (which is the correct input type for the media argument of send_media_group) have a corresponding argument.

Please see the docs of

  • send_media_group: PTB Telegram
  • InputMediaPhoto: PTB Telegram

and PTBs wiki entry on sending media groups.


Disclaimer: I'm currently the maintainer of python-telegram-bot.

like image 127
CallMeStag Avatar answered Oct 24 '25 12:10

CallMeStag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!