【发布时间】: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