def ohno(self, ctx, *words):
"""Generates your very own SCP-3078 cognitohazardous shitpost.
e.g. "when you inhale the devil's mary jane smoke"
"""
# Damn I tried to imitate the SCP-3078 instances but they don't follow
# the same layout in different imitations, so the first one is followed
# the best here.
font = ImageFont.truetype(join(folder, "Calibri.ttf"), 19)
append = None
width = 256
x_start = 22
y_cur = 13
y_pad = 3
image = Image.open(join(folder, "SCP-3078.png"))
draw = ImageDraw.Draw(image)
for word in words:
if append is None:
append = word
else:
prev = append
append = " ".join([append, word])
w, h = draw.textsize(append, font=font)
if w > width:
append = word
draw.text((x_start, y_cur), prev, fill=(0, 0, 0),
font=font)
y_cur += h + y_pad
if append is not None:
draw.text((x_start, y_cur), append, fill=(0, 0, 0), font=font)
image_bytes = BytesIO()
image.save(image_bytes, format="png")
image_bytes.seek(0)
await ctx.send(file=File(image_bytes, filename="SCP-3078.png"))
image_bytes.close()
评论列表
文章目录