removed small faults
This commit is contained in:
parent
6c99548941
commit
0f4d4e5624
@ -327,13 +327,13 @@ def send_news(message):
|
|||||||
top_news = news.get_top_news_by_keyword(keyword)["articles"]
|
top_news = news.get_top_news_by_keyword(keyword)["articles"]
|
||||||
if top_news == None: # true if request to NewsAPI failed
|
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.')
|
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)
|
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")
|
bot.send_message(chat_id=user_id, text=f'No news found for keyword: *{keyword}*', parse_mode="MARKDOWN")
|
||||||
return
|
|
||||||
|
|
||||||
formatted_article = news.format_article(top_news[0]) # only format and send most popular news
|
else:
|
||||||
bot.send_message(chat_id=user_id, text=f"_keyword: {keyword}_\n\n" + formatted_article, parse_mode="MARKDOWN")
|
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")
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(commands=['addkeyword', 'Addkeyword']) # /addkeyword -> add keyword to user
|
@bot.message_handler(commands=['addkeyword', 'Addkeyword']) # /addkeyword -> add keyword to user
|
||||||
|
Loading…
Reference in New Issue
Block a user