diff options
| author | 2019-05-12 10:34:50 +0200 | |
|---|---|---|
| committer | 2019-05-12 10:34:50 +0200 | |
| commit | bc844d0196f08ec414e76a5010047989fe2a7c33 (patch) | |
| tree | 9975341954b1963a5c72037281cea93566421c93 /bot/seasons | |
| parent | Hanukkah embed (#164) (diff) | |
| parent | Revert cat-induced programming trauma (diff) | |
Merge pull request #201 from python-discord/pypi-dpy
Change d.py Dependency from GH to PyPI
Diffstat (limited to 'bot/seasons')
| -rw-r--r-- | bot/seasons/christmas/adventofcode.py | 2 | ||||
| -rw-r--r-- | bot/seasons/easter/avatar_easterifier.py | 3 | ||||
| -rw-r--r-- | bot/seasons/evergreen/snakes/snakes_cog.py | 9 | ||||
| -rw-r--r-- | bot/seasons/evergreen/snakes/utils.py | 11 | ||||
| -rw-r--r-- | bot/seasons/halloween/spookyavatar.py | 5 | ||||
| -rw-r--r-- | bot/seasons/season.py | 2 | ||||
| -rw-r--r-- | bot/seasons/valentines/be_my_valentine.py | 2 | 
7 files changed, 12 insertions, 22 deletions
diff --git a/bot/seasons/christmas/adventofcode.py b/bot/seasons/christmas/adventofcode.py index 32858673..440484b4 100644 --- a/bot/seasons/christmas/adventofcode.py +++ b/bot/seasons/christmas/adventofcode.py @@ -132,7 +132,7 @@ class AdventOfCode(commands.Cog):      async def adventofcode_group(self, ctx: commands.Context):          """All of the Advent of Code commands.""" -        await ctx.invoke(self.bot.get_command("help"), "adventofcode") +        await ctx.send_help(ctx.command)      @adventofcode_group.command(          name="subscribe", diff --git a/bot/seasons/easter/avatar_easterifier.py b/bot/seasons/easter/avatar_easterifier.py index 9f7ea271..a84e5eb4 100644 --- a/bot/seasons/easter/avatar_easterifier.py +++ b/bot/seasons/easter/avatar_easterifier.py @@ -71,8 +71,7 @@ class AvatarEasterifier(commands.Cog):          async with ctx.typing():              # Grabs image of avatar -            async with self.bot.http_session.get(ctx.author.avatar_url_as(size=256)) as resp: -                image_bytes = await resp.read() +            image_bytes = await ctx.author.avatar_url_as(size=256).read()              old = Image.open(BytesIO(image_bytes))              old = old.convert("RGBA") diff --git a/bot/seasons/evergreen/snakes/snakes_cog.py b/bot/seasons/evergreen/snakes/snakes_cog.py index 3ffdf1bf..b5fb2881 100644 --- a/bot/seasons/evergreen/snakes/snakes_cog.py +++ b/bot/seasons/evergreen/snakes/snakes_cog.py @@ -458,7 +458,7 @@ class Snakes(Cog):      async def snakes_group(self, ctx: Context):          """Commands from our first code jam.""" -        await ctx.invoke(self.bot.get_command("help"), "snake") +        await ctx.send_help(ctx.command)      @bot_has_permissions(manage_messages=True)      @snakes_group.command(name='antidote') @@ -1055,13 +1055,6 @@ class Snakes(Cog):          )          await ctx.channel.send(embed=embed) -    @snakes_group.command(name='help') -    async def help_command(self, ctx: Context): -        """Invokes the help command for the Snakes Cog.""" - -        log.debug(f"{ctx.author} requested info about the snakes cog") -        return await ctx.invoke(self.bot.get_command("help"), "Snakes") -      @snakes_group.command(name='snakify')      async def snakify_command(self, ctx: Context, *, message: str = None):          """ diff --git a/bot/seasons/evergreen/snakes/utils.py b/bot/seasons/evergreen/snakes/utils.py index e2ed60bd..a7cb70a7 100644 --- a/bot/seasons/evergreen/snakes/utils.py +++ b/bot/seasons/evergreen/snakes/utils.py @@ -8,7 +8,6 @@ from itertools import product  from pathlib import Path  from typing import List, Tuple -import aiohttp  from PIL import Image  from PIL.ImageDraw import ImageDraw  from discord import File, Member, Reaction @@ -480,12 +479,10 @@ class SnakeAndLaddersGame:      async def _add_player(self, user: Member):          self.players.append(user)          self.player_tiles[user.id] = 1 -        avatar_url = user.avatar_url_as(format='jpeg', size=PLAYER_ICON_IMAGE_SIZE) -        async with aiohttp.ClientSession() as session: -            async with session.get(avatar_url) as res: -                avatar_bytes = await res.read() -                im = Image.open(io.BytesIO(avatar_bytes)).resize((BOARD_PLAYER_SIZE, BOARD_PLAYER_SIZE)) -                self.avatar_images[user.id] = im + +        avatar_bytes = await user.avatar_url_as(format='jpeg', size=PLAYER_ICON_IMAGE_SIZE).read() +        im = Image.open(io.BytesIO(avatar_bytes)).resize((BOARD_PLAYER_SIZE, BOARD_PLAYER_SIZE)) +        self.avatar_images[user.id] = im      async def player_join(self, user: Member):          """ diff --git a/bot/seasons/halloween/spookyavatar.py b/bot/seasons/halloween/spookyavatar.py index 15c7c431..2cc81da8 100644 --- a/bot/seasons/halloween/spookyavatar.py +++ b/bot/seasons/halloween/spookyavatar.py @@ -37,8 +37,9 @@ class SpookyAvatar(commands.Cog):              embed = discord.Embed(colour=0xFF0000)              embed.title = "Is this you or am I just really paranoid?"              embed.set_author(name=str(user.name), icon_url=user.avatar_url) -            resp = await self.get(user.avatar_url) -            im = Image.open(BytesIO(resp)) + +            image_bytes = await ctx.author.avatar_url.read() +            im = Image.open(BytesIO(image_bytes))              modified_im = spookifications.get_random_effect(im)              modified_im.save(str(ctx.message.id)+'.png')              f = discord.File(str(ctx.message.id)+'.png') diff --git a/bot/seasons/season.py b/bot/seasons/season.py index 6d992276..6d99b77f 100644 --- a/bot/seasons/season.py +++ b/bot/seasons/season.py @@ -442,7 +442,7 @@ class SeasonManager(commands.Cog):      async def refresh(self, ctx):          """Refreshes certain seasonal elements without reloading seasons."""          if not ctx.invoked_subcommand: -            await ctx.invoke(bot.get_command("help"), "refresh") +            await ctx.send_help(ctx.command)      @refresh.command(name="avatar")      async def refresh_avatar(self, ctx): diff --git a/bot/seasons/valentines/be_my_valentine.py b/bot/seasons/valentines/be_my_valentine.py index 19788577..8340d7fa 100644 --- a/bot/seasons/valentines/be_my_valentine.py +++ b/bot/seasons/valentines/be_my_valentine.py @@ -42,7 +42,7 @@ class BeMyValentine(commands.Cog):          2) use the command \".lovefest unsub\" to get rid of the lovefest role.          """ -        await ctx.invoke(self.bot.get_command("help"), "lovefest") +        await ctx.send_help(ctx.command)      @lovefest_role.command(name="sub")      async def add_role(self, ctx):  |