mirror of
https://gitlab.com/simple-stock-bots/simple-discord-stock-bot.git
synced 2025-06-16 07:16:41 +00:00
lots of small fixes
This commit is contained in:
parent
af8f8b7a0a
commit
5629a294df
13
bot.py
13
bot.py
@ -16,6 +16,7 @@ try:
|
||||
except KeyError:
|
||||
IEX_TOKEN = ""
|
||||
print("Starting without an IEX Token will not allow you to get market data!")
|
||||
s = Symbol(IEX_TOKEN)
|
||||
|
||||
|
||||
client = discord.Client()
|
||||
@ -24,9 +25,7 @@ intents = discord.Intents.default()
|
||||
intents.members = True
|
||||
bot = commands.Bot(
|
||||
command_prefix="/",
|
||||
description="Simple bot for getting stock market information. "
|
||||
+ "The bot responds to any ticker in a message with a dollar sign: $tsla. "
|
||||
+ "It also supports the commands below.",
|
||||
description=s.help_text,
|
||||
intents=intents,
|
||||
)
|
||||
|
||||
@ -126,7 +125,10 @@ async def search(ctx, *, query: str):
|
||||
async def crypto(ctx, symbol: str):
|
||||
"""Get the price of a cryptocurrency using in USD."""
|
||||
reply = s.crypto_reply(symbol)
|
||||
if reply:
|
||||
await ctx.send(reply)
|
||||
else:
|
||||
await ctx.send("Crypto Symbol could not be found.")
|
||||
|
||||
|
||||
@bot.command()
|
||||
@ -165,6 +167,7 @@ async def intra(ctx, sym: str):
|
||||
filename=f"{symbol.upper()}:{datetime.date.today().strftime('%d%b%Y')}.png",
|
||||
),
|
||||
)
|
||||
await ctx.send(f"{s.price_reply([symbol])[symbol]}")
|
||||
|
||||
|
||||
@bot.command()
|
||||
@ -201,12 +204,13 @@ async def chart(ctx, sym: str):
|
||||
filename=f"{symbol.upper()}:{datetime.date.today().strftime('1M%d%b%Y')}.png",
|
||||
),
|
||||
)
|
||||
await ctx.send(f"{s.price_reply([symbol])[symbol]}")
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_message(message):
|
||||
|
||||
if message.author == client.user:
|
||||
if message.author.id == bot.user.id:
|
||||
return
|
||||
|
||||
if message.content[0] == "/":
|
||||
@ -222,5 +226,4 @@ async def on_message(message):
|
||||
return
|
||||
|
||||
|
||||
s = Symbol(IEX_TOKEN)
|
||||
bot.run(DISCORD_TOKEN)
|
||||
|
14
functions.py
14
functions.py
@ -27,14 +27,14 @@ class Symbol:
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
Keep up with the latest news for the bot in itsTelegram Channel: https://t.me/simplestockbotnews
|
||||
Keep up with the latest news for the bot in its Discord Server: https://discord.gg/VtEHyyTBAK
|
||||
|
||||
Full documentation on using and running your own stock bot can be found [here.](https://simple-stock-bots.gitlab.io/site)
|
||||
Full documentation on using and running your own stock bot can be found here: https://simple-stock-bots.gitlab.io/site
|
||||
|
||||
**Commands**
|
||||
- /donate [amount in USD] to donate. 🎗️
|
||||
- /donate information on how to donate. 🎗️
|
||||
- /dividend $[symbol] will return dividend information for the symbol. 📅
|
||||
- /intra $[symbol] Plot of the stocks movement since the last market open. 📈
|
||||
- /chart $[symbol] Plot of the stocks movement for the past 1 month. 📊
|
||||
@ -59,13 +59,9 @@ Simple Stock Bot is run entirely on donations.
|
||||
All donations go directly towards paying for servers, and market data is provided by
|
||||
[IEX Cloud](https://iexcloud.io/).
|
||||
|
||||
The easiest way to donate is to run the `/donate [amount in USD]` command with USdollars you would like to donate.
|
||||
|
||||
Example: `/donate 2` would donate 2 USD.
|
||||
An alternative way to donate is through https://www.buymeacoffee.com/Anson,which accepts Paypal or Credit card.
|
||||
The best way to donate is through https://www.buymeacoffee.com/Anson which accepts Paypal or Credit card.
|
||||
If you have any questions get in touch: MisterBiggs#0465 or[anson@ansonbiggs.com](http://mailto:anson@ansonbiggs.com/)
|
||||
|
||||
_Donations can only be made in a chat directly with @simplestockbot_
|
||||
"""
|
||||
|
||||
def __init__(self, IEX_TOKEN: str) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user