Bot correction markdown and logic mistake in updater #172

Merged
FlorianKellermann merged 20 commits from bot into main 2022-05-10 20:45:53 +00:00
Showing only changes of commit d5c245856b - Show all commits

View File

@ -15,6 +15,7 @@ import sys
from apscheduler.schedulers.background import BackgroundScheduler
from api_handling.api_handler import API_Handler
import shares.share_fetcher as share_fetcher
import helper_functions as hf
'''
@ -165,6 +166,7 @@ def update_for_user(p_user_id, p_my_handler):
send_to_user("If you haven't read yet: \nHere are some interesting news according to your keywords:", pUser_id=p_user_id)
for keyword in keywords:
news = news_fetcher.get_top_news_by_keyword(keyword)["articles"]
keyword = hf.make_markdown_proof(keyword)
if not news: # if empty news array
send_to_user(f"No news found for keyword _{keyword}_.", pUser_id=p_user_id, md_mode=True)
@ -194,7 +196,7 @@ def send_to_user(pText, pUser_id , md_mode = False):
:rtype: none
"""
if md_mode:
bot.send_message(chat_id=pUser_id, text=pText, parse_mode="MARKDOWN")
bot.send_message(chat_id=pUser_id, text=pText, parse_mode="MARKDOWNV2")
else:
bot.send_message(chat_id=pUser_id, text=pText)