diff options
author | 2023-07-08 14:59:05 +0100 | |
---|---|---|
committer | 2023-07-08 14:59:05 +0100 | |
commit | 43cf31b20689bcb2bc1ba896bfb51b249b7a09bf (patch) | |
tree | d54faffce292d76046b958062d082e1e3c2afd1a /bot/exts | |
parent | Use built in timeout handling for aiohttp instead of async_timeout (diff) |
Fix: stop using deprecated PIL .getsize method
Diffstat (limited to 'bot/exts')
-rw-r--r-- | bot/exts/fun/snakes/_snakes_cog.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bot/exts/fun/snakes/_snakes_cog.py b/bot/exts/fun/snakes/_snakes_cog.py index 8381513a..2baacebc 100644 --- a/bot/exts/fun/snakes/_snakes_cog.py +++ b/bot/exts/fun/snakes/_snakes_cog.py @@ -241,8 +241,11 @@ class Snakes(Cog): # Draw the text onto the final image draw = ImageDraw.Draw(full_image) for line in textwrap.wrap(description, 36): - draw.text([margin + 4, offset], line, font=CARD["font"]) - offset += CARD["font"].getsize(line)[1] + draw.text((margin + 4, offset), line, font=CARD["font"]) + + _left, top, _right, bottom = CARD["font"].getbbox(line) + # Height of the text + 4px spacing + offset += bottom - top + 4 # Get the image contents as a BufferIO object buffer = BytesIO() |