1
0
mirror of https://gitlab.com/simple-stock-bots/simple-discord-stock-bot.git synced 2025-06-16 15:17:29 +00:00

documentation

This commit is contained in:
Anson Biggs 2021-02-11 20:49:23 -07:00
parent 4b8edfac37
commit af8f8b7a0a
2 changed files with 20 additions and 6 deletions

22
bot.py
View File

@ -2,14 +2,14 @@ import datetime
import io import io
import os import os
import discord
import mplfinance as mpf import mplfinance as mpf
import pandas as pd
import discord
from discord.ext import commands from discord.ext import commands
from functions import Symbol from functions import Symbol
DISCORD_TOKEN = os.environ["DISCORD"] DISCORD_TOKEN = "NjYyNzcyOTU5MzMyNTMyMjg2.Xg-1aw.Au28SCJJE3HLy23b3adREtLXFiY"
try: try:
IEX_TOKEN = os.environ["IEX"] IEX_TOKEN = os.environ["IEX"]
@ -24,7 +24,9 @@ intents = discord.Intents.default()
intents.members = True intents.members = True
bot = commands.Bot( bot = commands.Bot(
command_prefix="/", command_prefix="/",
description="Simple bot for getting stock market information.", 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.",
intents=intents, intents=intents,
) )
@ -40,8 +42,10 @@ async def on_ready():
@bot.command() @bot.command()
async def status(ctx): async def status(ctx):
"""Debug command for diagnosing if the bot is experiencing any issues."""
message = "" message = ""
try: try:
message = "Contact MisterBiggs#0465 if you need help.\n"
# IEX Status # IEX Status
message += s.iex_status() + "\n" message += s.iex_status() + "\n"
@ -57,16 +61,19 @@ async def status(ctx):
@bot.command() @bot.command()
async def license(ctx): async def license(ctx):
"""Returns the bots license agreement."""
await ctx.send(s.license) await ctx.send(s.license)
@bot.command() @bot.command()
async def donate(ctx): async def donate(ctx):
"""Details on how to support the development and hosting of the bot."""
await ctx.send(s.donate_text) await ctx.send(s.donate_text)
@bot.command() @bot.command()
async def stat(ctx, *, sym: str): async def stat(ctx, *, sym: str):
"""Get statistics on a list of stock symbols."""
symbols = s.find_symbols(sym) symbols = s.find_symbols(sym)
if symbols: if symbols:
@ -76,6 +83,7 @@ async def stat(ctx, *, sym: str):
@bot.command() @bot.command()
async def dividend(ctx, *, sym: str): async def dividend(ctx, *, sym: str):
"""Get dividend information on a stock symbol."""
symbols = s.find_symbols(sym) symbols = s.find_symbols(sym)
if symbols: if symbols:
@ -85,6 +93,7 @@ async def dividend(ctx, *, sym: str):
@bot.command() @bot.command()
async def news(ctx, *, sym: str): async def news(ctx, *, sym: str):
"""Get recent english news on a stock symbol."""
symbols = s.find_symbols(sym) symbols = s.find_symbols(sym)
if symbols: if symbols:
@ -94,6 +103,7 @@ async def news(ctx, *, sym: str):
@bot.command() @bot.command()
async def info(ctx, *, sym: str): async def info(ctx, *, sym: str):
"""Get information of a stock ticker."""
symbols = s.find_symbols(sym) symbols = s.find_symbols(sym)
if symbols: if symbols:
@ -103,6 +113,7 @@ async def info(ctx, *, sym: str):
@bot.command() @bot.command()
async def search(ctx, *, query: str): async def search(ctx, *, query: str):
"""Search for a stock symbol using either symbol of company name."""
results = s.search_symbols(query) results = s.search_symbols(query)
if results: if results:
reply = "*Search Results:*\n`$ticker: Company Name`\n" reply = "*Search Results:*\n`$ticker: Company Name`\n"
@ -113,12 +124,14 @@ async def search(ctx, *, query: str):
@bot.command() @bot.command()
async def crypto(ctx, symbol: str): async def crypto(ctx, symbol: str):
"""Get the price of a cryptocurrency using in USD."""
reply = s.crypto_reply(symbol) reply = s.crypto_reply(symbol)
await ctx.send(reply) await ctx.send(reply)
@bot.command() @bot.command()
async def intra(ctx, sym: str): async def intra(ctx, sym: str):
"""Get a chart for the stocks movement since market open."""
symbol = s.find_symbols(sym)[0] symbol = s.find_symbols(sym)[0]
@ -156,6 +169,7 @@ async def intra(ctx, sym: str):
@bot.command() @bot.command()
async def chart(ctx, sym: str): async def chart(ctx, sym: str):
"""Get a chart for the stocks movement for the past month."""
symbol = s.find_symbols(sym)[0] symbol = s.find_symbols(sym)[0]

View File

@ -55,7 +55,7 @@ Full documentation on using and running your own stock bot can be found [here.](
""" """
donate_text = """ donate_text = """
Simple Stock Bot is run entirely on donations[.](https://www.buymeacoffee.com/Anson) Simple Stock Bot is run entirely on donations.
All donations go directly towards paying for servers, and market data is provided by All donations go directly towards paying for servers, and market data is provided by
[IEX Cloud](https://iexcloud.io/). [IEX Cloud](https://iexcloud.io/).
@ -63,7 +63,7 @@ The easiest way to donate is to run the `/donate [amount in USD]` command with U
Example: `/donate 2` would donate 2 USD. 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. An alternative 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 or[anson@ansonbiggs.com](http://mailto:anson@ansonbiggs.com/) 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_ _Donations can only be made in a chat directly with @simplestockbot_
""" """