I was coding a telegram bot and ran into a problem. reply_markup doesn’t work when I use copy_message.
photo message
<code>import telebot
from telebot import types
from config import TOKEN
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=["start"])
def start(message):
markup = types.InlineKeyboardMarkup()
btn = types.InlineKeyboardButton("test", callback_data="123")
markup.add(btn)
bot.copy_message(message.chat.id, message.chat.id, message.id, reply_markup=markup)
bot.polling(non_stop=True)
</code>
<code>import telebot
from telebot import types
from config import TOKEN
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=["start"])
def start(message):
markup = types.InlineKeyboardMarkup()
btn = types.InlineKeyboardButton("test", callback_data="123")
markup.add(btn)
bot.copy_message(message.chat.id, message.chat.id, message.id, reply_markup=markup)
bot.polling(non_stop=True)
</code>
import telebot
from telebot import types
from config import TOKEN
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=["start"])
def start(message):
markup = types.InlineKeyboardMarkup()
btn = types.InlineKeyboardButton("test", callback_data="123")
markup.add(btn)
bot.copy_message(message.chat.id, message.chat.id, message.id, reply_markup=markup)
bot.polling(non_stop=True)
Am I doing something wrong, or is this just a bug in Telebot? (IDE does not give any error)
And what can I do to make button appear under a such message?
New contributor
BIG_REPA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.