Revert ".trump"

This reverts commit e53a6341a5.
This commit is contained in:
Ave Ozkal 2019-12-22 01:19:28 +03:00
parent fac3ac3605
commit b6f6b98480
No known key found for this signature in database
GPG key ID: 398DD7BD03276F6D
3 changed files with 0 additions and 63 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

View file

@ -77,69 +77,6 @@ class ImageManip(Cog):
await ctx.send(content=f"{mention}: Enjoy.",
file=discord.File(out_filename))
@commands.check(check_if_staff_or_ot)
@commands.command(hidden=True)
async def trump(self, ctx, *, headline: str):
"""Gives a trump tweet"""
mention = ctx.author.mention
in_header = "assets/trumpheader.png"
in_footer = "assets/trumpfooter.png"
font_path = "assets/Segoe UI.ttf"
# Settings for image generation, don't touch anything
horipos = 10
vertpos = 70
font_size = 27
image_width = 590
font_wrap_count = 45
sig_height = 49
# Wrap into lines
lines = textwrap.wrap(headline, width=font_wrap_count)
# not great, 4am be like
image_height = (len(lines) + 2) * vertpos
# Load font
f = PIL.ImageFont.truetype(font_path, font_size)
# Create image base, paste mobo logo
im = PIL.Image.new("RGB", (image_width, image_height), color="#15202B")
headerim = PIL.Image.open(in_header)
im.paste(headerim, (horipos, 15))
# Go through all the wrapped text lines
for line in lines:
# Get size of the text by font, create a new image of that size
size = f.getsize(line)
txt = PIL.Image.new('L', size)
# Draw the text
d = PIL.ImageDraw.Draw(txt)
d.text((0, 0), line, font=f, fill=255)
# Paste the text into the base image
w = txt.rotate(0, expand=1)
im.paste(PIL.ImageOps.colorize(w, (0, 0, 0),
(255, 255, 255)), (horipos, vertpos),
w)
# Calculate position on next line
vertpos += size[1]
# Add jcox signature
jcoxim = PIL.Image.open(in_footer)
im.paste(jcoxim, (horipos, vertpos + int(sig_height / 3)))
# Crop the image to the actual resulting size
im = im.crop((0, 0, image_width, vertpos + int(sig_height * 2.5)))
# Save image
out_filename = f"/tmp/{ctx.message.id}-out.png"
im.save(out_filename, quality=100, optimize=True)
await ctx.send(content=f"{mention}: Enjoy.",
file=discord.File(out_filename))
def setup(bot):
bot.add_cog(ImageManip(bot))