diff options
author | 2018-11-20 15:45:53 -0500 | |
---|---|---|
committer | 2018-11-20 15:45:53 -0500 | |
commit | 44825f97ea399fc077ec2d964d1a6c9da2069fed (patch) | |
tree | 008b24bc7cf84a95b638bdacc73a9ec195ea330a /bot/cogs/hacktober/spookyavatar.py | |
parent | Merge branch 'markylon-gif' (diff) |
Add typing context manager where appropriate
Some minor syntax & logic fixes where noticed
Diffstat (limited to 'bot/cogs/hacktober/spookyavatar.py')
-rw-r--r-- | bot/cogs/hacktober/spookyavatar.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/bot/cogs/hacktober/spookyavatar.py b/bot/cogs/hacktober/spookyavatar.py index ad8a9242..abfa1565 100644 --- a/bot/cogs/hacktober/spookyavatar.py +++ b/bot/cogs/hacktober/spookyavatar.py @@ -35,15 +35,17 @@ class SpookyAvatar: if user is None: user = ctx.message.author - 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)) - modified_im = spookifications.get_random_effect(im) - modified_im.save(str(ctx.message.id)+'.png') - f = discord.File(str(ctx.message.id)+'.png') - embed.set_image(url='attachment://'+str(ctx.message.id)+'.png') + async with ctx.typing(): + 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)) + modified_im = spookifications.get_random_effect(im) + modified_im.save(str(ctx.message.id)+'.png') + f = discord.File(str(ctx.message.id)+'.png') + embed.set_image(url='attachment://'+str(ctx.message.id)+'.png') + await ctx.send(file=f, embed=embed) os.remove(str(ctx.message.id)+'.png') |