From 43cf31b20689bcb2bc1ba896bfb51b249b7a09bf Mon Sep 17 00:00:00 2001 From: wookie184 Date: Sat, 8 Jul 2023 14:59:05 +0100 Subject: Fix: stop using deprecated PIL .getsize method --- bot/exts/fun/snakes/_snakes_cog.py | 7 +++++-- 1 file 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() -- cgit v1.2.3