C
C
che_aa2021-03-07 16:30:00
Python
che_aa, 2021-03-07 16:30:00

How to pass entities to telebot?

The official api https://core.telegram.org/bots/api#sendmessage has the entities parameter, but when I pass it to telebot I get an error:

TypeError: send_message() got an unexpected keyword argument 'entities'

The code:
import telebot

bot = telebot.TeleBot(token)

@bot.message_handler(content_types = ['text', 'audio', 'document', 'photo'])
def messages(message):
  bot.send_message(message.chat.id, text=message.text, entities = message.entities)		
bot.polling(none_stop = True, timeout=123)

How can I fix this error, and are there any alternatives to pass entisies

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Krostelev, 2021-03-08
@che_aa

You are not looking there. The telebot library is just a connecting part between the Telegram Bot API and python. There is no entities parameter
in the bot.send_message method , you can follow the link and see what happens "under the hood". Perhaps the aiogram library has the necessary functionality.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question