从InlineKeyboardButton单击URL后删除键盘

问题描述 投票:0回答:1

我正在为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个回答
0
投票

不幸的是,你做不到。

带有InlineKeyboardButtonURL仅显示用户打开链接的按钮。据我所知,Telegram的API中没有事件可以在用户实际打开链接时触发(甚至点击按钮!)

© www.soinside.com 2019 - 2024. All rights reserved.