mirror of
https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git
synced 2025-06-16 15:06:53 +00:00
bug crunching
This commit is contained in:
parent
78218834e4
commit
0368834159
4
bot.py
4
bot.py
@ -242,6 +242,7 @@ def intra(update: Update, context: CallbackContext):
|
|||||||
text="Invalid symbol please see `/help` for usage details.",
|
text="Invalid symbol please see `/help` for usage details.",
|
||||||
parse_mode=telegram.ParseMode.MARKDOWN,
|
parse_mode=telegram.ParseMode.MARKDOWN,
|
||||||
)
|
)
|
||||||
|
return
|
||||||
|
|
||||||
context.bot.send_chat_action(
|
context.bot.send_chat_action(
|
||||||
chat_id=chat_id, action=telegram.ChatAction.UPLOAD_PHOTO
|
chat_id=chat_id, action=telegram.ChatAction.UPLOAD_PHOTO
|
||||||
@ -282,6 +283,7 @@ def chart(update: Update, context: CallbackContext):
|
|||||||
text="Invalid symbol please see `/help` for usage details.",
|
text="Invalid symbol please see `/help` for usage details.",
|
||||||
parse_mode=telegram.ParseMode.MARKDOWN,
|
parse_mode=telegram.ParseMode.MARKDOWN,
|
||||||
)
|
)
|
||||||
|
return
|
||||||
|
|
||||||
context.bot.send_chat_action(
|
context.bot.send_chat_action(
|
||||||
chat_id=chat_id, action=telegram.ChatAction.UPLOAD_PHOTO
|
chat_id=chat_id, action=telegram.ChatAction.UPLOAD_PHOTO
|
||||||
@ -430,7 +432,7 @@ def main():
|
|||||||
dp.add_handler(CommandHandler("search", search))
|
dp.add_handler(CommandHandler("search", search))
|
||||||
dp.add_handler(CommandHandler("intraday", intra))
|
dp.add_handler(CommandHandler("intraday", intra))
|
||||||
dp.add_handler(CommandHandler("intra", intra, run_async=True))
|
dp.add_handler(CommandHandler("intra", intra, run_async=True))
|
||||||
dp.add_handler(CommandHandler("chart", chart, run_async=True))
|
dp.add_handler(CommandHandler("chart", chart))
|
||||||
dp.add_handler(CommandHandler("crypto", crypto))
|
dp.add_handler(CommandHandler("crypto", crypto))
|
||||||
dp.add_handler(CommandHandler("random", rand_pick))
|
dp.add_handler(CommandHandler("random", rand_pick))
|
||||||
dp.add_handler(CommandHandler("donate", donate))
|
dp.add_handler(CommandHandler("donate", donate))
|
||||||
|
10
functions.py
10
functions.py
@ -99,13 +99,15 @@ _Donations can only be made in a chat directly with @simplestockbot_
|
|||||||
return symbols, datetime.now()
|
return symbols, datetime.now()
|
||||||
|
|
||||||
def iex_status(self):
|
def iex_status(self):
|
||||||
status = r.get("https://pjmps0c34hp7.statuspage.io/api/v2/status.json").json()
|
status = r.get("https://pjmps0c34hp7.statuspage.io/api/v2/status.json").json()[
|
||||||
|
"status"
|
||||||
|
]
|
||||||
|
|
||||||
if status["status"]["indicator"] == "none":
|
if status["indicator"] == "none":
|
||||||
return "IEX Cloud is currently not reporting any issues with its API."
|
return "IEX Cloud is currently not reporting any issues with its API."
|
||||||
else:
|
else:
|
||||||
return (
|
return (
|
||||||
f"{['status']['indicator']}: {['status']['description']}."
|
f"{status['indicator']}: {status['description']}."
|
||||||
+ " Please check the status page for more information. https://status.iexapis.com"
|
+ " Please check the status page for more information. https://status.iexapis.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -336,7 +338,7 @@ _Donations can only be made in a chat directly with @simplestockbot_
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
response = r.get(
|
response = r.get(
|
||||||
"https://cloud.iexapis.com/stable/stock/{symbol}/chart/1mm?token={self.IEX_TOKEN}&chartInterval=3&includeToday=false"
|
f"https://cloud.iexapis.com/stable/stock/{symbol}/chart/1mm?token={self.IEX_TOKEN}&chartInterval=3&includeToday=false"
|
||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user