用按钮的电信电报消息
我正在尝试创建一个新闻电报机器人。但是II无法发送带有交互式按钮的消息。
我之所以使用按钮是为了制作菜单,如果您可以显示一个互动菜单而不是仅添加它的示例,我将不胜感激。
使用语言:Python 3.9& 像这样的电信库
:
I'm trying create a news telegram bot. But iI can't send messages with interactive buttons.
The reason why I use the buttons is to make a menu, I would appreciate if you could show an example of making an interactive menu instead of just adding it.
Using Language : Python 3.9 & Telebot Library
Like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
telebot 为InlineKeyboard提供以下类型:
inlineKeyboardMarksmarkmarkup
;键盘
一个基本示例看起来
将导致以下消息发送到
chat_id
:Telebot provides the following types for InlineKeyboard:
InlineKeyboardMarkup
; The keyboardInlineKeyboardButton
; The markup buttonAn basic example would look like
Which will result in the following message send to
chat_id
:在此示例中,我们创建一个带有两个按钮的菜单,“按钮1”和“按钮2”,然后分别处理每个按钮。当用户选择一个按钮时,机器人发送相应的消息。
In this example, we create a menu with two buttons, "Button 1" and "Button 2", and process each button separately. When the user selects one of the buttons, the bot sends the corresponding message.
使用回调查询处理程序,这里有示例:
https://github.com/eternnoir/pytelegrambotapi/blob/master/master/examples/inline_keyboard_example.py.py
use callback query handler, there is example here:
https://github.com/eternnoir/pyTelegramBotAPI/blob/master/examples/inline_keyboard_example.py