【发布时间】:2022-07-22 07:17:14
【问题描述】:
有些代码我创建了一个ReplyKeyboardMarkup 并希望在单击“聊天”按钮后隐藏ID。 这个怎么做?不发送新消息并删除她,例如: bot.send_message(mes.chat.id,“工作”,reply_markup=types.ReplyKeyboardRemove()) bot.delete_message(mes.chat.id, mes.message_id + 1)
以“/start”开头的代码:
def start_markup():
markup = types.ReplyKeyboardMarkup(resize_keyboard=True, row_width=2)
chat = types.KeyboardButton(text="Chat",)
markup.add(chat)
return markup
@bot.message_handler(commands=['start'])
def start(mes):
res = bot.send_message(mes.chat.id , "Chose what do u want", reply_markup=start_markup())
//此时我已经不得不隐藏回复键盘了
@bot.message_handler()
def get_message(mes):
if mes.text == "Chat":
markup = types.InlineKeyboardMarkup().add(types.InlineKeyboardButton(text='Click', url='...'))
bot.send_message(mes.chat.id, "Click!!!", reply_markup = markup)
【问题讨论】:
标签: python bots telegram-bot telebot