|
|
|
@@ -84,7 +84,7 @@ def send_help(message):
|
|
|
|
|
|
|
|
|
|
:rtype: none
|
|
|
|
|
"""
|
|
|
|
|
bot.reply_to(message, "/id or /auth get your user id\n/update get updates on your shares.\n/shares get update on interesting shares\n/setAdmin set admin rights of user (ADMIN)\n/users see all users. (ADMIN)\n/me get my user info\n/news get top article for each keyword.\n/allnews get all news (last 7 days)\n/keywords get all your keywords\n/addkeyword add a keyword\n/removekeyword remove a keyword\n/transactions get all transactions\n/newtransaction create new transaction\n/share get price of specific share\n/portfolio see own portfolio\n/removeshare removes share from portfolio\n/interval get update interval\n/setinterval set update interval\n_For further details see https://gruppe1.testsites.info _", parse_mode='MARKDOWNV2')
|
|
|
|
|
bot.reply_to(message, "/id or /auth get your user id\n/update get updates on your shares.\n/shares get update on interesting shares\n/setAdmin set admin rights of user (ADMIN)\n/users see all users. (ADMIN)\n/me get my user info\n/news get top article for each keyword.\n/allnews get all news (last 7 days)\n/keywords get all your keywords\n/addkeyword add a keyword\n/removekeyword remove a keyword\n/transactions get all transactions\n/newtransaction create new transaction\n/share get price of specific share\n/portfolio see own portfolio\n/removeshare removes share from portfolio\n/interval get update interval\n/setinterval set update interval\n For further details see https://gruppe1.testsites.info")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['users', 'Users']) # /users -> sending all users
|
|
|
|
@@ -317,7 +317,7 @@ def send_all_news(message):
|
|
|
|
|
if news_list: # true if news_list is not empty
|
|
|
|
|
for article in news_list:
|
|
|
|
|
formatted_article = news.format_article(article)
|
|
|
|
|
bot.send_message(chat_id=user_id, text=hf.make_markdown_proof(formatted_article), parse_mode="MARKDOWN") # Markdown allows to write bold text with * etc.
|
|
|
|
|
bot.send_message(chat_id=user_id, text=formatted_article, parse_mode="MARKDOWNV2") # Markdown allows to write bold text with * etc.
|
|
|
|
|
else:
|
|
|
|
|
bot.send_message(chat_id=user_id, text='No news found for your keywords.')
|
|
|
|
|
|
|
|
|
@@ -356,8 +356,8 @@ def send_news(message):
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
keyword = hf.make_markdown_proof(keyword)
|
|
|
|
|
formatted_article = hf.make_markdown_proof(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") # do not use v2 because of bugs related t "." in links
|
|
|
|
|
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="MARKDOWNV2") # do not use v2 because of bugs related t "." in links
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['addkeyword', 'Addkeyword']) # /addkeyword -> add keyword to user
|
|
|
|
@@ -458,9 +458,9 @@ def send_portfolio(message):
|
|
|
|
|
else: # send portfolio
|
|
|
|
|
for stock in portfolio:
|
|
|
|
|
comment = hf.make_markdown_proof(str(stock["comment"])) # comment may be written name of stock, comment is made by user when adding an stock to portfolio
|
|
|
|
|
count = "{:.2f}".format(float(stock["count"])) # round count to 2 decimal places
|
|
|
|
|
count = hf.make_markdown_proof("{:.2f}".format(float(stock["count"]))) # round count to 2 decimal places
|
|
|
|
|
isin = hf.make_markdown_proof(str(stock["isin"]))
|
|
|
|
|
worth = "{:.2f}".format(float(stock["current_price"]) * float(stock["count"])) # round current_price to 2 decimal places
|
|
|
|
|
worth = hf.make_markdown_proof("{:.2f}".format(float(stock["current_price"]) * float(stock["count"]))) # round current_price to 2 decimal places
|
|
|
|
|
bot.send_message(chat_id=user_id, text=f'*{comment}*\n_{isin}_\namount: {count}\nworth: ${worth}', parse_mode="MARKDOWNV2") # formatted message in markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|