Discord.py: Embeds: Add ability to have blank lines or value='' without throwing HTTPException: BAD REQUEST

Created on 11 Jul 2017  路  8Comments  路  Source: Rapptz/discord.py

When trying to format my Embed I want to have blank lines or html


style lines to split up the fields.

Currently I don't see how to do that. Because of the way embeds.py is setup I can't just put False or None as my value because it's converted to a string and then I see None or False in discord. If I put in value='' or value=' ' I always get

Traceback (most recent call last):
File "/home/jason/projects/python_discord_bot/env/lib/python3.5/site-packages/discord/ext/commands/core.py", line 50, in wrapped
ret = yield from coro(args, *kwargs)
File "TheRuffian.py", line 111, in readycheck
return await TheRuffian.send_message(ctx.message.channel, embed=embed)
File "/home/jason/projects/python_discord_bot/env/lib/python3.5/site-packages/discord/client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "/home/jason/projects/python_discord_bot/env/lib/python3.5/site-packages/discord/http.py", line 199, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/jason/projects/python_discord_bot/env/lib/python3.5/site-packages/discord/ext/commands/bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "/home/jason/projects/python_discord_bot/env/lib/python3.5/site-packages/discord/ext/commands/core.py", line 374, in invoke
yield from injected(ctx.args, *ctx.kwargs)
File "/home/jason/projects/python_discord_bot/env/lib/python3.5/site-packages/discord/ext/commands/core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: BAD REQUEST (status code: 400)

invalid question

Most helpful comment

You want '\u200b' for a zero width space not '\u200'.

All 8 comments

Use value='\u200' for a zero width space
I've used it successfully multiple times

You want '\u200b' for a zero width space not '\u200'.

You guys are champions. This gets me closer to where I want to be, but it does leave a large space that I'd rather not have under the name variable. I'd rather just not have the embed take up the space for value if I don't want a value in the field.

try using \a

the \a gave me the same result as \u200b

this is not an issue with the library. discord does not allow you to have an empty name/value for a field, which is why you get the http exception.

if the zero-width space workaround (or similar ones) doesn't do what you want, then your only other option is to ask discord to change this behavior - i doubt they will do so, but that's another story.

Ok. Appreciate the clarification.

It is actually Possible To add just one blank line.
In The value field after you have put your description. Just add "\n\u200b"
embed.add_field(name=title, value=description + "\n\u200b")
This will add a space below the current field.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tairabiteru picture tairabiteru  路  3Comments

AraHaan picture AraHaan  路  3Comments

Yolotroll101 picture Yolotroll101  路  3Comments

j0hnmeow picture j0hnmeow  路  3Comments

Be4Vision picture Be4Vision  路  3Comments