【问题标题】:How to use both callback_data and url in InlineKeyboardButton python telegram如何在 InlineKeyboardButton python 电报中同时使用 callback_data 和 url
【发布时间】:2022-07-05 01:02:53
【问题描述】:

我想计算有多少用户点击了一个按钮,我使用了 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 参数时,回调按预期工作......有没有办法同时使用这两个参数?

【问题讨论】:

    标签: python telegram telegram-bot


    【解决方案1】:

    我试图做同样的事情,但显然 你不能。 callback_data 和 url 是互斥的参数。

    您可以在这里找到更多信息:https://docs.python-telegram-bot.org/en/stable/telegram.inlinekeyboardbutton.html

    【讨论】:

      猜你喜欢
      • 2022-01-27
      • 2020-10-05
      • 2021-03-16
      • 2021-10-28
      • 2021-08-23
      • 1970-01-01
      • 2022-08-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多