TypeError: send_message() got an unexpected keyword argument 'entities'
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)
import telebot
from telebot.types import Message, MessageEntity
def get_entity_type(etype):
arr_etype = str(etype).split('.')
result = arr_etype[1].lower()
# if etype == "MessageEntityType.TEXT_LINK":
return result
def send_message_entity(message, target, message_thread_id=None):
entities = []
for entity in message.entities:
if entity.user is not None:
user = entity.user
else:
user = None
if entity.offset is not None:
offset = entity.offset
else:
offset = None
if entity.type is not None:
type_entity = get_entity_type(entity.type)
else:
type_entity = None
if entity.length is not None:
length = entity.length
else:
length = None
if entity.url is not None:
url = entity.url
entities.append(MessageEntity(type=type_entity, offset=offset, length=length, url=url, user=user))
bot.send_message(chat_id=target, text=message.text, message_thread_id=message_thread_id, entities=entities)