Python telegram bot || Can help with the bot, parser?

I did bot in a telegram to the sending of news from a particular site.
When you turn on the parser itself without the bot, it displays all the information from news feeds to the console, but when I turn the bot write command at Tg for information, it sends only one news. Fix my code and make it so he sent 5 or 10 news from the tape instead of one.
from bs4 import BeautifulSoup
import requests
import telebot

bot = telebot.TeleBot('config.token')
url = ''
page = requests.get(url)
new_news = []
soup = BeautifulSoup(page.text, "html.parser")
news = soup.findAll('a', class_='lenta')
for i in range(len(news)):
 if news[i].find('span', class_='time2 time3') is not None:
for i in range(len(new_news)):

 def start_message(message):
 bot.send_message(, 'Hello, you wrote me /start')

 def send_text(message):
 if message.text == 'news':
 bot.send_message( new_news[:5])
 elif message.text == 'News':
 bot.send_message( new_news[:5])

April 19th 20 at 12:29
1 answer
April 19th 20 at 12:31
It is necessary to send not new_news[:5], and
elif message.text == 'News':
bot.send_message(, ' '.join(new_news[:5]))

Ahem... I do not understand to be honest - elmira18 commented on April 19th 20 at 12:34
@Scottie91, well, in the function send_message need to pass a string, not a list. The join function inserts '' between the list elements and returns a string - Abbey.Satterfield commented on April 19th 20 at 12:37
@oliver.Funk45, but as I know in '' must be , or am I wrong ? - elmira18 commented on April 19th 20 at 12:40
Friend , thank you , understood . Good luck in the future ! - elmira18 commented on April 19th 20 at 12:43

Find more questions by tags TelegramPython