简体   繁体   English

如何使用无文本在 telebot.py 中发送消息?

[英]How to send message in telebot.py with None text?

API says that you can't send message with no text but i have to show keyboard to user due to: API 说您无法发送没有文本的消息,但我必须向用户显示键盘,因为:

bot.send_message(id, text, markup = keyboard)

So how can i change keyboard or send another with no text?那么我怎样才能更改键盘或发送另一个没有文字的键盘?

You cannot update KeyboardButtons without sending texts.您无法在不发送文本的情况下更新KeyboardButtons

Workaround,解决方法,

  • Send a dummy message with desired buttons and delete the message immediately.(Tip: use disable_notification=True , so user won't be notified of this message).发送带有所需按钮的虚拟消息并立即删除该消息。(提示:使用disable_notification=True ,因此不会通知用户此消息)。 Buttons will be updated按钮将更新

UPDATE更新

Deleting the message actually deletes the button too.删除消息实际上也删除了按钮。 editReplyMarkup doesnot work on ReplyKeyboardMarkup (the normal keyboard buttons) editReplyMarkup用于ReplyKeyboardMarkup (普通键盘按钮)

You can use InlineKeyboardButtons , which can be edited (this is what I am using)您可以使用可以编辑的InlineKeyboardButtons (这是我正在使用的)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM