您可以在媒体组中使用电报内联键盘吗?

2024-04-25 21:58:25 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在阅读文档,虽然.sendMessage()方法有reply_标记参数,您可以在其中传递内联键盘,但媒体组(相册、少量文件等)没有这样的参数

# 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]]))

我只是想确保这是真的,因为其他类型的消息都可以有一个内联键盘


Tags: 文档httpscom参数pngbotgooglebutton
1条回答
网友
1楼 · 发布于 2024-04-25 21:58:25

媒体组不能有回复标记。无论是send_media_group方法还是InputMedia*类(这是send_media_groupmedia参数的正确输入类型)都没有相应的参数

请参阅

PTBs wiki entry发送媒体组


免责声明:我目前是python-telegram-bot的维护者

相关问题 更多 >

    热门问题