removed small faults
This commit is contained in:
parent
6c99548941
commit
0f4d4e5624
@ -327,11 +327,11 @@ def send_news(message):
|
||||
top_news = news.get_top_news_by_keyword(keyword)["articles"]
|
||||
if top_news == None: # true if request to NewsAPI failed
|
||||
bot.send_message(chat_id=user_id, text='News Server did not respond correctly. Try again later.')
|
||||
return
|
||||
|
||||
if not top_news: # true if no news found for keyword (empty list)
|
||||
bot.send_message(chat_id=user_id, text=f'No news found for keyword: *{keyword}*', parse_mode="MARKDOWN")
|
||||
return
|
||||
|
||||
else:
|
||||
formatted_article = news.format_article(top_news[0]) # only format and send most popular news
|
||||
bot.send_message(chat_id=user_id, text=f"_keyword: {keyword}_\n\n" + formatted_article, parse_mode="MARKDOWN")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user