链接按钮的电报callback_data [英] Telegram callback_data for link buttons

查看:117
本文介绍了链接按钮的电报callback_data的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过Telegram机器人发送链接按钮,我想在用户打开网址后获取callback_data。

I'm sending a link button throught a Telegram bot and I would like to get the callback_data after the user opens the url.

我的选择是:

var options = {
          parse_mode: "Markdown",
          reply_markup: {
            inline_keyboard: btns
          }
        };

其中btns是

[
    [{ text: "Read first", url: "http://any", callback_data: "any_relevant_data }]
]

按钮显示完美,链接有效,但是没有触发回调,我从不点击

The button shows perfectly, the link works, but no callback is triggered and I never hit

bot.on('callback_query', (callback_message) => { //any action });

这是缺少的功能还是我在做错什么了?

Is this a missing feature or it's me, doing something wrong?

推荐答案

根据 API文档,您不能使用 url 文本同时使用。

According to API Document, you can't use url and text in the same time.


此对象代表一个按钮

This object represents one button of an inline keyboard.

您必须完全使用可选字段之一。

You must use exactly one of the optional fields.

这篇关于链接按钮的电报callback_data的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆