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:
Telebot provides the following types for InlineKeyboard:
InlineKeyboardMarkup
; The keyboardInlineKeyboardButton
; The markup buttonAn basic example would look like
from telebot import TeleBot
from telebot import types
bot = TeleBot("859163076:A......")
chat_id = 12345
button_foo = types.InlineKeyboardButton('Foo', callback_data='foo')
button_bar = types.InlineKeyboardButton('Bar', callback_data='bar')
keyboard = types.InlineKeyboardMarkup()
keyboard.add(button_foo)
keyboard.add(button_bar)
bot.send_message(chat_id, text='Keyboard example', reply_markup=keyboard)
Which will result in the following message send to chat_id
: