Having troubles with sending image with text. Instead of actual image, I’m just getting the path to it. I wonder if someone knows what is the problem in my code. Instead of the path I want an actual image
import telebot
from telebot import types
bot = telebot.TeleBot("token")
@bot.message_handler(commands = ['start'])
def button(message):
markup = types.InlineKeyboardMarkup(row_width=2)
item_4 = types.InlineKeyboardButton('q1', callback_data ='da')
item_3 = types.InlineKeyboardButton("asdas", callback_data = 'net')
markup.add(item_4, item_3)
img = r'C:Pythonk123s.jpg'
text = 'Your profile!'
bot.send_message(message.chat.id, f'{text}n{img}', reply_markup = markup)
2
Answers
I found the solution:
PyTelegramBotApi has captions, which lets you add text to photos
caption = 'text'
Instead of
send_message
you need to usesend_photo
.In your case, the last 3 lines will be: