feat: add redis cache to store polls state

This commit is contained in:
2021-07-30 17:06:23 -04:00
parent 2336e159c7
commit db1bb161d6
8 changed files with 123 additions and 62 deletions

View File

@@ -3,13 +3,15 @@ import requests
import json
from discord.ext import commands
ALPHAVANTAGE_API_KEY = os.getenv('ALPHAVANTAGE_API_KEY')
LUNAR_CRUSH_API_KEY = os.getenv("LUNAR_CRUSH_API_KEY")
class Finance(commands.Cog):
"""Commands to query stock and crypto prices."""
@commands.command(usage="<tickers>")
async def stock(self, ctx, *tickers: str) -> None:
"""Gets prices for the given stock tickers. Will default tickers to AAPL, GOOG, MSFT and AMZN if none provided."""
ALPHAVANTAGE_API_KEY = os.getenv('ALPHAVANTAGE_API_KEY')
# default tickers
if len(tickers) == 0:
@@ -43,7 +45,6 @@ class Finance(commands.Cog):
@commands.command(usage="<tickers>")
async def crypto(self, ctx, *tickers: str) -> None:
"""Gets prices for the given crypto tickers. Will default tickers to BTC, ETH and LTC if none provided."""
LUNAR_CRUSH_API_KEY = os.getenv("LUNAR_CRUSH_API_KEY")
# default tickers
if len(tickers) == 0: