diff options
| author | 2019-05-13 12:17:29 +0100 | |
|---|---|---|
| committer | 2019-05-13 12:17:29 +0100 | |
| commit | 6601f367593d2654f48cc12a5fd8c337a487d877 (patch) | |
| tree | 4ec2cf46f9674c231264fd462057cce45035bca9 /bot/seasons/evergreen/snakes/utils.py | |
| parent | Removed unused import. (diff) | |
| parent | Spooky 8 Ball (#189) (diff) | |
Merge pull request #2 from python-discord/master
Get up to date.
Diffstat (limited to 'bot/seasons/evergreen/snakes/utils.py')
| -rw-r--r-- | bot/seasons/evergreen/snakes/utils.py | 11 |
1 files changed, 4 insertions, 7 deletions
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): """ |