Merge branch 'bot-features' of https://github.com/WebEngineering2/TelegramAktienBot into bot-features

This commit is contained in:
NormalParameter
2022-03-15 15:02:58 +01:00
4 changed files with 40 additions and 3 deletions

View File

@@ -21,8 +21,12 @@ import time
import sys
import logging
<<<<<<< HEAD
import news_fetcher
import share_fetcher
=======
import news.news_fetcher as news
>>>>>>> 725f9806b7109b68219cc273edc616c1059ee4bb
from telebot import types
from dotenv import load_dotenv
@@ -184,9 +188,9 @@ def send_news(message):
user_id = int(message.from_user.id)
#Get Information for user with this id
articles = news_fetcher.get_top_news_by_keyword(keyword) #tbd: get keyword from db
articles = news.get_top_news_by_keyword(keyword) #tbd: get keyword from db
try:
formatted_article = news_fetcher.format_article(articles["articles"][0])
formatted_article = news.format_article(articles["articles"][0])
except IndexError:
bot.send_message(chat_id=user_id, text=f"no news currently available for keyword: {keyword}")
return