diff options
Diffstat (limited to 'bot/seasons/halloween/spookyavatar.py')
| -rw-r--r-- | bot/seasons/halloween/spookyavatar.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/bot/seasons/halloween/spookyavatar.py b/bot/seasons/halloween/spookyavatar.py index 15c7c431..9bdef1a8 100644 --- a/bot/seasons/halloween/spookyavatar.py +++ b/bot/seasons/halloween/spookyavatar.py @@ -19,8 +19,7 @@ class SpookyAvatar(commands.Cog): self.bot = bot async def get(self, url): - """Returns the contents of the supplied url.""" - + """Returns the contents of the supplied URL.""" async with aiohttp.ClientSession() as session: async with session.get(url) as resp: return await resp.read() @@ -29,7 +28,6 @@ class SpookyAvatar(commands.Cog): brief='Spookify an user\'s avatar.') async def spooky_avatar(self, ctx, user: discord.Member = None): """A command to print the user's spookified avatar.""" - if user is None: user = ctx.message.author @@ -37,8 +35,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') @@ -50,6 +49,5 @@ class SpookyAvatar(commands.Cog): def setup(bot): """Spooky avatar Cog load.""" - bot.add_cog(SpookyAvatar(bot)) log.info("SpookyAvatar cog loaded") |