Reputation: 3
So, I have a problem and I can´t fix it. I'm trying to back an embed in which some information is displayed in the Rolle isn´t working
if message.content.startswith("!userinfo"):
args = message.content.split(" ")
if len(args) == 2:
member: Member = discord.utils.find(
lambda m: args[1] in m.name, message.guild.members)
if member:
myEmbed = discord.Embed(title="Userinfo für {}".format(member.name),
description=" für den User {}".format(
member.mention),
color=0x22a7f0)
myEmbed.add_field(name="Server beigetreten", value=member.joined_at.strftime(
"%d/%m/%Y, %H:%M:%S"), inline=True)
myEmbed.add_field(name="Server beigetreten", value=member.created_at.strftime(
"%d/%m/%Y, %H:%M:%S"), inline=True)
rollen = " "
for role in member.roles:
if not role.is_default():
rollen += "{} \r\n".format(role.mention)
if rollen:
myEmbed.add_field(
name="Rollen", value=rollen, inline=True)
myEmbed.set_thumbnail(url=member.avatar_url)
myEmbed.set_footer(text="Ich bin ein Kek")
await message.channel.send(embed=myEmbed)
Error:
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In embed.fields.2.value: This field is required
Upvotes: 0
Views: 221
Reputation: 5650
I think the error is quite self-explanatory. The value of Field 2
is empty, and it's not allowed to be. You just gave it " "
as value, which isn't enough. Leading & trailing spaces are stripped out, so it becomes an empty string (""
), which leaves the field empty.
If you want a field without any content, use \u200b
("zero width space") & it'll appear empty.
myEmbed.add_field(name="Rollen", value="\u200b", inline=True)
Upvotes: 1