async def undertale( self, ctx: commands.Context, texto: str, usuario: nextcord.Member = None ): """Bajo cuento""" avatar_info = [ { "url": get_user(ctx, usuario).avatar.url, "size": 160, "x": 120, "y": 88, } ] character_image_size = 200 # Get user avatar_url = get_user(ctx, usuario).avatar.url sprite = ( Image.open(io.BytesIO(requests.get(avatar_url).content)) .convert("L") .resize((character_image_size, character_image_size)) ) # Open resources image = Image.open(meme_resources_path + "dialogue_box.png") font = ImageFont.truetype( meme_resources_path + "Determination-Sans.otf", size=60 ) txtPic1 = Image.new("RGBA", (800, 270)) draw = ImageDraw.Draw(txtPic1) # Convert character picture wpercent = character_image_size / float(sprite.size[0]) hsize = int((float(sprite.size[1]) * float(wpercent))) sprite = sprite.resize((character_image_size, hsize), Image.ANTIALIAS) image.paste(sprite, (70, 90)) # Add text lines = textwrap.wrap(texto, width=25) Y = 20 for line in lines: width, height = font.getsize(line) draw.text(((10, Y)), line, font=font, fill=(255, 255, 255, 255)) Y = Y + height image.paste(txtPic1, (350, 50), txtPic1) # Send image bytes_io = io.BytesIO() image.save(bytes_io, "PNG") bytes_io.seek(0) await ctx.send(file=nextcord.File(bytes_io, "output.png"))
async def quien( self, ctx: commands.Context, text1: str, text2: str, user: nextcord.Member = None, ): """Quien ha sido? Uso: fur quien <texto1> <texto2> @<usuario> Ejemplo: fur quien "Le gustan los chilenos?" "Si" @Thedax """ Y = 20 Y_aux = 10 avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 130, "x": 210, "y": 570, } ] # Get user avatar avatarUrl = get_user(ctx, user).avatar.url meme = create_meme("quien", avatar_info) txtPic = Image.new("RGBA", (200, 200)) img = Image.open(meme).convert("RGBA") draw = ImageDraw.Draw(txtPic) font = ImageFont.truetype(meme_resources_path + "Calibri.ttf", 24) lines = textwrap.wrap(text1, width=18) for line in lines: draw.text(((0, Y)), line, font=font, fill=(0, 0, 0, 255)) Y = Y + 25 draw.text(((170, 170)), text2, font=font, fill=(0, 0, 0, 255)) img.paste(txtPic, (180, 10), txtPic) # Save bytes_io = io.BytesIO() img.save(bytes_io, "PNG") bytes_io.seek(0) # Send meme await ctx.send(file=nextcord.File(bytes_io, "output.png"))
async def patada(self, ctx: commands.Context, user: nextcord.Member = None): """Te vas a comer mi pie""" # Create meme avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 110, "x": 198, "y": 229, }, { "url": get_user(ctx, user).avatar.url, "size": 85, "x": 348, "y": 915, }, ] meme = create_meme("patada", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def cute(self, ctx: commands.Context, user: nextcord.Member = None): """You are cute""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 387, "x": 210, "y": 75, } ] meme = create_meme("cute", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def impostor(self, ctx: commands.Context, user: nextcord.Member = None): """Quién es el impostor?""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 205, "x": 323, "y": 175, } ] meme = create_meme("impostor", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def stonks(self, ctx: commands.Context, user: nextcord.Member = None): """Stonks""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 236, "x": 63, "y": 25, } ] meme = create_meme("stonks", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def coding(self, ctx: commands.Context, user: nextcord.Member = None): """Programa como un pro hacker""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 167, "x": 218, "y": 137, } ] meme = create_meme("coding", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def unsee(self, ctx: commands.Context, user: nextcord.Member = None): """No por favor""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 108, "x": 256, "y": 112, } ] meme = create_meme("unsee", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def mierda(self, ctx: commands.Context, user: nextcord.Member = None): """Menudo montón de mierda""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 270, "x": 476, "y": 161, } ] meme = create_meme("mierda", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def radiopatio(self, ctx: commands.Context, user: nextcord.Member = None): """Es hora del cotilleo""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 88, "x": 188, "y": 45, } ] meme = create_meme("radiopatio", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def omni(self, ctx: commands.Context, user: nextcord.Member = None): """Omniman""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 470, "x": 210, "y": 388, } ] meme = create_meme("omni", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def reviento(self, ctx: commands.Context, user: nextcord.Member = None): """a que me reviento""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 78, "x": 315, "y": 80, } ] meme = create_meme("reviento", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def slap(self, ctx: commands.Context, user: nextcord.Member = None): """slap""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 160, "x": 120, "y": 88, } ] meme = create_meme("slap", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def palomitas(self, ctx: commands.Context, user: nextcord.Member = None): """Este drama está interesante""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 125, "x": 278, "y": 67, } ] meme = create_meme("palomitas", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def horny(self, ctx: commands.Context, user: nextcord.Member = None): """Mucho horny""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 300, "x": 410, "y": 180, } ] # Create meme meme = create_meme("horny", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def jojo(self, ctx: commands.Context, user: nextcord.Member): """Za warudo""" avatar_info = [ { "url": get_user(ctx, user).avatar.url, "size": 65, "x": 162, "y": 19, }, { "url": ctx.author.avatar.url, "size": 65, "x": 469, "y": 130, }, ] meme = create_meme("jojo", avatar_info) # Send meme await ctx.send(file=nextcord.File(meme, "output.png"))
async def quote( self, ctx: commands.Context, quote: str, title: str, user: nextcord.Member = None, ): """Crea una quote en imagen Uso: fur quote "<quote>" "<titulo>" <@usuario para poner foto> - Si el quote tiene " reemplazar por ' Ejemplo: fur quote "Gala: 'Ala Teko que racista'" "Gala, antiracistas" @Gala - Si se quiere poner algo tipo: Gala:"Hola que ase" Enana:"He reparido" se tiene que poner una / entre las dos lineas. Ejemplo: fur quote "Gala:'Hola que ase'/Enana:'He reparido' "Gala, antiracistas" @Gala """ # Variables userName = get_user(ctx, user) avatarSize = 300 txtSize = 40 textX = 10 textY = 10 textOffsetX = 420 textOffsetY = 200 avatarX = 50 avatarY = 150 lineWidth = 31 # Change ' with " because the command needs "" to get the quote and the title if "'" not in quote: quote = quote.replace("'", '"') quote = '"' + quote + '"' # Open images txtPic = Image.new("RGBA", (620, 500)) pic = Image.open(meme_resources_path + "quote.png").convert("RGBA") avatar = ( Image.open(io.BytesIO(requests.get(userName.avatar.url).content)) .convert("L") .resize((avatarSize, avatarSize)) ) # Set up fonts fontQuote = ImageFont.truetype(meme_resources_path + "Sofia.ttf", txtSize) fontTitle = ImageFont.truetype(meme_resources_path + "Calibri.ttf", txtSize - 5) d = ImageDraw.Draw(txtPic) # Write quote cont = 0 if "/" in quote: # quote with line break lines = quote.split("/") for line in lines: width, height = fontQuote.getsize(line) if len(line) > lineWidth: lines2 = textwrap.wrap(line, width=lineWidth) for line in lines2: width, height = fontQuote.getsize(line) d.text((textX, textY), line, font=fontQuote, fill=None) textY += height cont += 1 else: d.text((textX, textY), line, font=fontQuote, fill=None) textY += height cont += 1 else: # quote without line break lines = textwrap.wrap(quote, width=lineWidth) if lines[-1] == '"': # If last line is only a " lines[-2] = lines[-2] + '"' # Put " in line before lines.pop(-1) # Remove line with " firstLine = True for line in lines: width, height = fontQuote.getsize(line) if firstLine is True: # put the first line furthest to the left d.text(((textX - 10), textY), line, font=fontQuote, fill=None) firstLine = False else: d.text(((textX), textY), line, font=fontQuote, fill=None) cont += 1 textY += height # Write title firstLine = True lines = textwrap.wrap(title, width=lineWidth) if len(lines) > 1: textY += 15 for line in lines: width, height = fontTitle.getsize(line) d.text(((textX), textY), line, font=fontTitle, fill=None) cont += 0.4 textY += height + 5 else: d.text(((textX) + 5, textY + 30), title, font=fontTitle, fill=None) # Paste in meme picture pic.paste(avatar, (avatarX, avatarY), avatar) pic.paste(txtPic, (textOffsetX, int(220 - 20 * cont)), txtPic) # Save picture bytes_io = io.BytesIO() pic.save(bytes_io, "PNG") bytes_io.seek(0) await ctx.send(file=nextcord.File(bytes_io, "output.png"))