Skip to content

Commit

Permalink
Move XKCD to it's own extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
scragly committed May 23, 2019
1 parent 23ee1fb commit d987106
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 120 deletions.
5 changes: 3 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
discord-py = {git = "https://github.com/Rapptz/discord.py",ref = "3f06f24"}
[packages]
"discord.py" = {git = "https://github.com/Rapptz/discord.py",ref = "3f06f24"}
python-dateutil = ">=2.6"
asyncpg = ">=0.13"
python-levenshtein = ">=0.12"
Expand All @@ -17,6 +17,7 @@ numpy = "*"
pendulum = "*"
pytz = "*"
matplotlib = "*"
async_timeout = "~=3.0"

[requires]
python_version = "3.6"
Expand Down
192 changes: 86 additions & 106 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions eevee/cogs/public_tests/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,3 @@ async def vote(self, ctx, title, *, content):
await asyncio.sleep(0.5)
await msg.add_reaction(dv)
await ctx.message.delete()

@command()
async def xkcd(self, ctx, comic_number: int = None):
url_num = f"{comic_number}/" if comic_number else ""
url = f"https://xkcd.com/{url_num}info.0.json"
async with async_timeout.timeout(10):
async with ctx.bot.session.get(url) as response:
xkcd_data = await response.json()
title = (f"{xkcd_data['safe_title']} - "
f"{xkcd_data['num']} - "
f"{xkcd_data['year']}/{xkcd_data['month']}/{xkcd_data['day']}")
await ctx.embed(title, footer=xkcd_data['alt'], image=xkcd_data['img'])

0 comments on commit d987106

Please sign in to comment.