Registrations currently disabled due to spam. Contact me externally if you need an account

Skip to content
Snippets Groups Projects
Commit 5270c621 authored by PhenoM4n4n's avatar PhenoM4n4n
Browse files

[typeracer] update quote api

parent 87905ccc
No related branches found
No related tags found
Loading
......@@ -24,7 +24,7 @@ class TypeRacer(commands.Cog):
FONT_SIZE = 30
__version__ = "1.0.3"
__version__ = "1.0.4"
def __init__(self, bot: Red) -> None:
self.bot = bot
......@@ -48,13 +48,13 @@ class TypeRacer(commands.Cog):
pass
async def get_quote(self) -> Tuple[str, str]:
# async with self.session.get("https://api.quotable.io/random") as resp:
# data = await resp.json()
# return resp["content"], resp["author"]
# old api went down, if it starts working again I'd like to switch back to it
async with self.session.get("https://zenquotes.io/api/random") as resp:
data = json.loads(await resp.text())[0]
return data["q"], data["a"]
async with self.session.get("https://api.quotable.io/random") as resp:
data = await resp.json()
return data["content"], data["author"]
# back up api in case above goes down
# async with self.session.get("https://zenquotes.io/api/random") as resp:
# data = await resp.json(content_type=None)[0]
# return data["q"], data["a"]
@property
def font(self) -> ImageFont:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment