Fixed string indent on stock command, and added more aliases
This commit is contained in:
parent
46838c888c
commit
67121365cb
1 changed files with 6 additions and 3 deletions
9
main.py
9
main.py
|
@ -5,6 +5,7 @@ from discord.ext import commands
|
||||||
import config as cfg
|
import config as cfg
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import typing
|
import typing
|
||||||
|
import inspect
|
||||||
|
|
||||||
if cfg.use_mongodb:
|
if cfg.use_mongodb:
|
||||||
import mongo as database
|
import mongo as database
|
||||||
|
@ -25,19 +26,21 @@ async def ping(ctx):
|
||||||
await ctx.send("pong!")
|
await ctx.send("pong!")
|
||||||
|
|
||||||
|
|
||||||
@bot.command()
|
@bot.command(aliases=["stock", "t", "s"])
|
||||||
async def ticker(ctx, stock):
|
async def ticker(ctx, stock):
|
||||||
user = str(ctx.message.author)
|
user = str(ctx.message.author)
|
||||||
stock = stock.upper()
|
stock = stock.upper()
|
||||||
|
|
||||||
data = yfi.stock_info(stock)
|
data = yfi.stock_info(stock)
|
||||||
return await ctx.send(
|
return await ctx.send(
|
||||||
"""**{ticker}**
|
inspect.cleandoc(
|
||||||
|
"""**{ticker}**
|
||||||
|
|
||||||
Bid: {bid}
|
Bid: {bid}
|
||||||
Ask: {ask}
|
Ask: {ask}
|
||||||
""".format(
|
""".format(
|
||||||
ticker=stock, bid=data["bid"], ask=data["ask"]
|
ticker=stock, bid=data["bid"], ask=data["ask"]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue