I can't display all texts in the same embed with python from discord bot
Question:
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…
It should be all in the same embed
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!
Answers:
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)
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…
It should be all in the same embed
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!
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)