Consolodating the stock message interpolation and adding a help section for tts
This commit is contained in:
parent
74c1d18749
commit
0289483038
@ -94,7 +94,11 @@ def get_help_message(method):
|
|||||||
'stock': [
|
'stock': [
|
||||||
'Returns basic stock information for the stock you entered.',
|
'Returns basic stock information for the stock you entered.',
|
||||||
'\nUsage: !stock AAPL TSLA'
|
'\nUsage: !stock AAPL TSLA'
|
||||||
]
|
],
|
||||||
|
'tts': [
|
||||||
|
'Uploads a file with the specified text as an MP3. This is advanced shitposting',
|
||||||
|
'\nUsage: !tts who watches the watchmen?'
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print out every help method
|
# Print out every help method
|
||||||
|
16
app/stock.py
16
app/stock.py
@ -13,12 +13,14 @@ def parse_share(msg):
|
|||||||
|
|
||||||
def get_stock(share_name):
|
def get_stock(share_name):
|
||||||
|
|
||||||
url = "https://api.iextrading.com/1.0/stock/{}/quote".format(share_name)
|
request = requests.get("https://api.iextrading.com/1.0/stock/{}/quote".format(share_name)).json()
|
||||||
request = requests.get(url).json()
|
|
||||||
|
|
||||||
open_price = request['open']
|
|
||||||
curr_price = request['latestPrice']
|
|
||||||
change = request['change']
|
|
||||||
changePercent = request['changePercent']
|
|
||||||
return '```Company Name: {}\nSymbol: {}\nSector: {}\n\nOpen: ${}\nCurrently: ${}\nChange: ${}\nChange percent {}%```'.format(
|
return '```Company Name: {}\nSymbol: {}\nSector: {}\n\nOpen: ${}\nCurrently: ${}\nChange: ${}\nChange percent {}%```'.format(
|
||||||
request['companyName'], request['symbol'], request['sector'], open_price, curr_price, change, changePercent)
|
request['companyName'],
|
||||||
|
request['symbol'],
|
||||||
|
request['sector'],
|
||||||
|
request['open'],
|
||||||
|
request['latestPrice'],
|
||||||
|
request['change'],
|
||||||
|
request['changePercent']
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user