mirror of
https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git
synced 2025-06-16 15:06:53 +00:00
Close #40
This commit is contained in:
parent
4578ad43f1
commit
38853582d1
9
bot.py
9
bot.py
@ -46,6 +46,14 @@ def help(update, context):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def license(update, context):
|
||||||
|
"""Return bots license agreement"""
|
||||||
|
|
||||||
|
update.message.reply_text(
|
||||||
|
text=Symbol.license, parse_mode=telegram.ParseMode.MARKDOWN
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def symbol_detect(update, context):
|
def symbol_detect(update, context):
|
||||||
"""
|
"""
|
||||||
Runs on any message that doesn't have a command and searches for symbols, then returns the prices of any symbols found.
|
Runs on any message that doesn't have a command and searches for symbols, then returns the prices of any symbols found.
|
||||||
@ -307,6 +315,7 @@ def main():
|
|||||||
# on different commands - answer in Telegram
|
# on different commands - answer in Telegram
|
||||||
dp.add_handler(CommandHandler("start", start))
|
dp.add_handler(CommandHandler("start", start))
|
||||||
dp.add_handler(CommandHandler("help", help))
|
dp.add_handler(CommandHandler("help", help))
|
||||||
|
dp.add_handler(CommandHandler("license", license))
|
||||||
dp.add_handler(CommandHandler("dividend", dividend))
|
dp.add_handler(CommandHandler("dividend", dividend))
|
||||||
dp.add_handler(CommandHandler("div", dividend))
|
dp.add_handler(CommandHandler("div", dividend))
|
||||||
dp.add_handler(CommandHandler("news", news))
|
dp.add_handler(CommandHandler("news", news))
|
||||||
|
11
functions.py
11
functions.py
@ -17,6 +17,15 @@ class Symbol:
|
|||||||
SYMBOL_REGEX = "[$]([a-zA-Z]{1,4})"
|
SYMBOL_REGEX = "[$]([a-zA-Z]{1,4})"
|
||||||
|
|
||||||
searched_symbols = {}
|
searched_symbols = {}
|
||||||
|
charts = {}
|
||||||
|
|
||||||
|
license = re.sub(
|
||||||
|
r"\b\n",
|
||||||
|
"",
|
||||||
|
r.get(
|
||||||
|
"https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot/-/raw/master/LICENSE"
|
||||||
|
).text,
|
||||||
|
)
|
||||||
|
|
||||||
help_text = """
|
help_text = """
|
||||||
Thanks for using this bot, consider supporting it by [buying me a beer.](https://www.buymeacoffee.com/Anson)
|
Thanks for using this bot, consider supporting it by [buying me a beer.](https://www.buymeacoffee.com/Anson)
|
||||||
@ -45,7 +54,7 @@ Market data is provided by [IEX Cloud](https://iexcloud.io)
|
|||||||
def __init__(self, IEX_TOKEN: str):
|
def __init__(self, IEX_TOKEN: str):
|
||||||
self.IEX_TOKEN = IEX_TOKEN
|
self.IEX_TOKEN = IEX_TOKEN
|
||||||
self.get_symbol_list()
|
self.get_symbol_list()
|
||||||
self.charts = {}
|
|
||||||
schedule.every().monday.do(self.get_symbol_list)
|
schedule.every().monday.do(self.get_symbol_list)
|
||||||
schedule.every().day.do(self.clear_charts)
|
schedule.every().day.do(self.clear_charts)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user