news working
This commit is contained in:
@@ -245,13 +245,18 @@ def send_news(message):
|
||||
|
||||
user_id = int(message.from_user.id)
|
||||
keywords = api_handler.get_user_keywords(user_id)
|
||||
keywords_search = ','.join(keywords)
|
||||
|
||||
keywords_search = ' OR '.join(keywords)
|
||||
print(keywords_search)
|
||||
news_list = news.get_top_news_by_keyword(keywords_search)["articles"]
|
||||
|
||||
for article in news_list:
|
||||
formatted_article = news.format_article(article)
|
||||
bot.send_message(chat_id=user_id, text=formatted_article, parse_mode="MARKDOWN")
|
||||
if news_list:
|
||||
for article in news_list:
|
||||
formatted_article = news.format_article(article)
|
||||
bot.send_message(chat_id=user_id, text=formatted_article, parse_mode="MARKDOWN")
|
||||
else:
|
||||
bot.send_message(chat_id=user_id, text='No news found for your keywords.')
|
||||
|
||||
|
||||
|
||||
|
||||
@bot.message_handler(commands=['addkeyword'])
|
||||
|
||||
Reference in New Issue
Block a user