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 display all texts in the same embed with python from discord bot

ok, i’m trying to add all the texts in the same embed of a for bot for discord, but i can’t do it, this is what happens to me…

enter image description here

It should be all 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

What should I do to correct this error? Thank you very much!

this is the code i am using…

import requests
import discord
from discord.ext import commands


bot = commands.Bot(command_prefix='!', description="ayuda bot") 
bot.remove_command("help") p

 
@bot.command()
async def habbo(ctx):
    response = requests.get("https://images.habbo.com/habbo-web-leaderboards/hhes/visited-rooms/daily/latest.json")
    data= response.json()
    


    for habbo in data:
         
         embed=discord.Embed(title=f"", description=f"{habbo['name']}", color=discord.Colour.random())
         await ctx.send(embed=embed)


@bot.event
async def on_ready():
    print("BOT listo!")   
 
    
bot.run('') 

Someone give me a hand, thank you very much! 😢

>Solution :

If you want to send multiple embed, don’t create multiple, build the content, then send one

@bot.command()
async def habbo(ctx):
    response = requests.get("https://images.habbo.com/habbo-web-leaderboards/hhes/visited-rooms/daily/latest.json")
    data = response.json()
    content = '\n'.join(item['name'] for item in data)
    embed = discord.Embed(title=f"", description=f"{content}", color=discord.Colour.random())
    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