Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I can't show the dates in the same embed with python from discord BOT

I have created a bot for discord that shows all the dates of any fortnite skin through the api, but my problem is that it does not show me all the dates inside the embed with the !skin command, it only shows me a date in timestamp format

this is the code:

@bot.command()
async def skin(ctx):
    url = requests.get("https://fortnite-api.com/v2/cosmetics/br/search/all?language=es&name=palito%20de%20pescado%20de%20gominola&searchLanguage=es")
    historialSKIN= url.json()
    
    for i in historialSKIN["data"]:
     for datestr in i['shopHistory']:
        fecha = int(isoparse(datestr).timestamp())

    embed=discord.Embed(title="Titulo", description=f"{fecha}")
    embed.add_field(name="Skin", value="skin", inline=False)
    await ctx.send(embed=embed)

What should I do to show all the dates in the same embed?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thank you very much in advance!

I should stay like this:

can someone help me, thank you very much!

>Solution :

Your variable "fecha" must be array or string to contain all your dates.

Here’s the code, it should work. I think I’ve shown you the problem and then you’ll figure it out for yourself.

@bot.command()
async def skin(ctx):
    url = requests.get("https://fortnite-api.com/v2/cosmetics/br/search/all?language=es&name=palito%20de%20pescado%20de%20gominola&searchLanguage=es")
    historialSKIN= url.json()
    fecha = ""
    for i in historialSKIN["data"]:
     for datestr in i['shopHistory']:
        fecha += str(isoparse(datestr).timestamp()) +"\n"

    embed=discord.Embed(title="Titulo", description=fecha)
    embed.add_field(name="Skin", value="skin", inline=False)
    await ctx.send(embed=embed)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading