【问题标题】:Remove Keyboard after clicking URL from InlineKeyboardButton从 InlineKeyboardButton 单击 URL 后删除键盘
【发布时间】:2019-04-17 04:29:07
【问题描述】:

我正在 python 中为 /commands 创建一个包装器

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

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

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

在这种情况下,我被卡住了。

与 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.

【问题讨论】:

    标签: python python-3.x telegram telegram-bot python-telegram-bot


    【解决方案1】:

    很遗憾,你不能。

    InlineKeyboardButtonURL 仅显示用户打开链接的按钮。据我所知,当用户实际打开链接(甚至点击按钮!)

    【讨论】:

    • 谢谢,伙计!感谢您的投入!我已经试过了,你说的很有道理。没有任何内容被发送回机器人,因此无法删除。我不会再打我的头了!非常感谢。
    • @TheVoice 乐于助人
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-19
    • 1970-01-01
    • 2023-03-24
    • 1970-01-01
    • 2016-07-29
    相关资源
    最近更新 更多