Hi I'm trying to embed some content from a .txt file as a list in to an embed however I'm having an issue to display it as a list on the command !changelog .
I get this error:
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400): Invalid Form Body
Here is what I have got so far:
@commands.command(invoke_without_command=True, case_insensitive=True)
@checks.is_channel_mod()
async def changelog(self, ctx):
changelog = open("changelog.txt").readlines()
embed = discord.Embed(description=changelog, colour=discord.Color(random.randint(0x000000, 0xFFFFFF)))
embed.title = "Changelog"
embed.set_image(url='')
await ctx.send(embed=embed)
Your help would be appreciated.
Join the list with newlines:
embed = discord.Embed(description='\n'.join(changelog),
colour=discord.Color(random.randint(0x000000, 0xFFFFFF))
title='Changelog')
await ctx.send(embed=embed)
or just use read
instead of readlines
with open("changelog.txt") as f:
changelog = f.read()
embed = discord.Embed(description=changelog,
colour=discord.Color(random.randint(0x000000, 0xFFFFFF))
title='Changelog')
await ctx.send(embed=embed)