I am creating a bot for discord that generates images, but I have a problem and it is giving me a problem and it does not generate the image and I cannot find the possible solution
image: https://i.stack.imgur.com/f9Raw.png
here I leave my code, to see if someone can help me solve it
import json
import requests
import discord
from discord.ext import commands
from PIL import Image, ImageDraw, ImageFont
bot = commands.Bot(command_prefix='!', description="ayuda bot")
bot.remove_command("help")
@bot.command()
async def item(ctx, *, Nombre):
response = requests.get(f"https://fortnite-api.com/v2/cosmetics/br/search/all?language=es&name=" +Nombre+ "&searchLanguage=es")
imagen = response.json()['data'][0]['images']['icon']
url_imagen = f"{imagen}"
nombre_local_imagen = "cosmetic.png"
imagen = requests.get(url_imagen).content
with open(nombre_local_imagen, 'wb') as handler:
handler.write(imagen)
img2 = Image.open(r"cosmetico.png")
img1 = Image.open(r"cosmetico.png")
draw = ImageDraw.Draw(img2)
font = ImageFont.truetype("BurbankBigCondensed-Black.otf", 60)
draw.text((75, 10), f"IKÓNIKO", font=font, fill="white")
img1.paste(img2,(0,0), mask = img2)
img1.save("cosmetico.png")
await ctx.send(file=discord.File('cosmetico.png'))
img1.save("cosmetico.png")
bot.run('')
Let's see if someone could give me a cable to solve it ☺
Thank you very much in advance!