如何在inlinekeyboardbutton python电报中同时使用callback_data和url
我想计算有多少用户单击一个按钮,然后我使用了callback_data:
for n in list2 :
buttons.append([InlineKeyboardButton(n[0], callback_data=f"click on { n[0] }" , url = "https://t.me/test")])
context.bot.send_message(chat_id=update.effective_chat.id, reply_markup=InlineKeyboardMarkup(buttons), text="List of my channals")
该按钮确实打开了URL,但它不会发出回调请求,当我删除URL参数回调时,请按预期工作...同时使用两个参数的方法?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我试图做同样的事情,但是显然你不能。 callback_data和URL是相互排斥的参数。
您可以在此处找到更多信息:
I was trying to do the same thing, but apparently you can't. The callback_data and url are mutually exclusive arguments.
You can find more info here: https://docs.python-telegram-bot.org/en/stable/telegram.inlinekeyboardbutton.html