从 InlineKeyboardButton 单击 URL 后删除键盘

Remove Keyboard after clicking URL from InlineKeyboardButton

我正在为 python

中的 /commands 创建一个包装器

我创建了一个带有 URL 的 InlineKeyboardButton 来私下聊天机器人。我希望按钮删除或消失,只是在用户单击 url 按钮后不显示。

我使用了电报教程中的通用包装器。

但是,我是一个 "newb" :) 一直在努力学习新的东西,我可以分享。

在这种情况下,我陷入了困境。

与 callback_data 不同,后者可以将数据发送到另一个按钮以编辑消息。 URL 不发送任何内容。我只是希望按钮消失或最好的替代隐藏或其他东西。

有什么想法吗??

向哪个方向移动:)

我查看了 ReplyKeyboardRemove 和 OneTimeKeyboard,但要么我的语法不正确,要么无法使用 URL 按钮

def myrestricted(func):
    @wraps(func)
    def wrapped(bot, update):
        user = update.message.from_user.username
        if update.message.chat.type != "private" :
            group = update.message.chat.id
            if user not in ADMIN_ONLY:
                button = [InlineKeyboardButton("7heUnknown_Bot", url='t.me/7heUnknown_Bot',],
                bot.send_message(chat_id=update.message.chat_id, text="Please click the button below to talk with me privately")
                return
        return func(bot, update)
    return wrapped```

When the user clicks on the URL button I want the button to disappear.

很遗憾,你不能。

InlineKeyboardButton加上一个URL只显示一个供用户打开的按钮link。据我所知,Telegram 的 API 中没有 event 可以在用户实际 opens link(甚至 点击 按钮!)