|
1 | 1 | # Original module author: t.me/KeyZenD
|
2 |
| -# Adaptation for Moon-Userbot by t.me/AmokDev (github.com/AmokDev) |
| 2 | +# Adaptation for Dragon-Userbot by t.me/AmokDev (github.com/AmokDev) |
| 3 | +# Adaptation for Moon-Userbot by Abhi |
3 | 4 |
|
4 | 5 | from io import BytesIO
|
5 | 6 | from random import randint
|
@@ -30,9 +31,11 @@ async def amogus(client: Client, message: Message):
|
30 | 31 | imposter = Image.open(BytesIO(get(f"{url}{clr}.png").content))
|
31 | 32 |
|
32 | 33 | text_ = "\n".join(["\n".join(wrap(part, 30)) for part in text.split("\n")])
|
33 |
| - w, h = ImageDraw.Draw(Image.new("RGB", (1, 1))).multiline_textsize( |
34 |
| - text_, font, stroke_width=2 |
| 34 | + bbox = ImageDraw.Draw(Image.new("RGB", (1, 1))).multiline_textbbox( |
| 35 | + (0, 0), text_, font, stroke_width=2 |
35 | 36 | )
|
| 37 | + # w, h = bbox[2] - bbox[0], bbox[3] - bbox[1] |
| 38 | + w, h = bbox[2], bbox[3] |
36 | 39 | text = Image.new("RGBA", (w + 30, h + 30))
|
37 | 40 | ImageDraw.Draw(text).multiline_text(
|
38 | 41 | (15, 15), text_, "#FFF", font, stroke_width=2, stroke_fill="#000"
|
|
0 commit comments