implemented /news and deleted debugbot (edit BOT_API_KEY instead) #2
@ -23,12 +23,9 @@ import logging
|
|||||||
|
|
||||||
import news.news_fetcher as news
|
import news.news_fetcher as news
|
||||||
import shares.share_fetcher as share_fetcher
|
import shares.share_fetcher as share_fetcher
|
||||||
import shares.wait_for_share
|
|
||||||
|
|
||||||
from telebot import types
|
from telebot import types
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
import shares.wait_for_share
|
|
||||||
from shares.share_fetcher import Share_Handler
|
|
||||||
|
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
@ -164,7 +161,7 @@ def send_update(message):
|
|||||||
"""
|
"""
|
||||||
user_id = int(message.from_user.id)
|
user_id = int(message.from_user.id)
|
||||||
|
|
||||||
share_fetcher = Share_Handler()
|
share_fetcher = share_fetcher.Share_Handler()
|
||||||
|
|
||||||
#Get Information for user with this id
|
#Get Information for user with this id
|
||||||
#call Share_Handler
|
#call Share_Handler
|
||||||
@ -186,9 +183,13 @@ def send_update(message):
|
|||||||
|
|
||||||
#Get Information for user with this id
|
#Get Information for user with this id
|
||||||
bot.send_message(chat_id=user_id, text='Send symbol of share:')
|
bot.send_message(chat_id=user_id, text='Send symbol of share:')
|
||||||
str_share_price = shares.wait_for_share.main_loop(bot)
|
#str_share_price = shares.wait_for_share.main_loop(bot)
|
||||||
|
bot.register_next_step_handler(message, send_share_price)
|
||||||
|
|
||||||
|
def send_share_price(message):
|
||||||
|
share_fetcher_obj = share_fetcher.Share_Handler()
|
||||||
|
str_share_price = share_fetcher_obj.get_share_price(str(message.text))
|
||||||
|
bot.reply_to(message, str_share_price)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,9 +7,7 @@ __version__ = "0.0.2"
|
|||||||
__license__ = "None"
|
__license__ = "None"
|
||||||
|
|
||||||
import yfinance
|
import yfinance
|
||||||
import telebot
|
|
||||||
|
|
||||||
# S3W03GQH43I8O6IG
|
|
||||||
|
|
||||||
class Share_Handler:
|
class Share_Handler:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
import time
|
|
||||||
import telebot
|
|
||||||
import share_fetcher
|
|
||||||
|
|
||||||
bot = 0
|
|
||||||
|
|
||||||
@bot.message_handler(func=lambda message: True)
|
|
||||||
def send_share_price(message):
|
|
||||||
fetcher = share_fetcher.Share_Handler()
|
|
||||||
str_price = fetcher.get_share_price(str(message.text))
|
|
||||||
return str_price
|
|
||||||
|
|
||||||
|
|
||||||
def main_loop(p_bot):
|
|
||||||
|
|
||||||
""" Get Information about bot status every 3 seconds
|
|
||||||
:raises: none
|
|
||||||
|
|
||||||
:rtype: none
|
|
||||||
"""
|
|
||||||
bot = p_bot
|
|
||||||
bot.infinity_polling()
|
|
||||||
while 1:
|
|
||||||
time.sleep(3)
|
|
Loading…
Reference in New Issue
Block a user