How i can make a line break in Discord embed in Python?
Question:
Im trying to make a space between each embed field, I tried to use u200B
and n
but it does not work to me. ( Using Python to create discord bot)
async def cmd_help(self, ctxt):
embed=discord.Embed(
color=ctxt.author.color,
description=f'All Command**{self.client.user.mention}**'
)
embed.set_author(name=self.client.user.name, icon_url=self.client.user.avatar_url)
embed.add_field(name='Server Command', value='`p!ping`>>Check the ping from server to bot.n`p!list`>>Check the number of users in the server.', inline=False)
embed.add_field(name='Users Command', value='`!kick`>>Kick the user from server.', inline=False)
await ctxt.send(embed=embed)
Answers:
Since you want to add extra space between 2 fields then that’s a good workaround:
embed.add_field(name='Server Command', value='`p!ping`>>Check the ping from server to bot.n`p!list`>>Check the number of users in the server.', inline=False)
embed.add_field(name = chr(173), value = chr(173))
embed.add_field(name='Users Command', value='`!kick`>>Kick the user from server.', inline=False)
What I did is that I added another field between both of them and I set its name and value to an empty character.
You can enclose your text within triple quotes(''' text '''
) and then use it for the embed.
so your code should look something like this:
value = '''p!ping`>>Check the ping from server to bot.
`p!list`>>Check the number of users in the server.'''
embed.add_field(name='Server Command', value=value, inline=False)
A benefit of this way is that you can also add blank lines in between so that the text looks more aesthetic
Im trying to make a space between each embed field, I tried to use u200B
and n
but it does not work to me. ( Using Python to create discord bot)
async def cmd_help(self, ctxt):
embed=discord.Embed(
color=ctxt.author.color,
description=f'All Command**{self.client.user.mention}**'
)
embed.set_author(name=self.client.user.name, icon_url=self.client.user.avatar_url)
embed.add_field(name='Server Command', value='`p!ping`>>Check the ping from server to bot.n`p!list`>>Check the number of users in the server.', inline=False)
embed.add_field(name='Users Command', value='`!kick`>>Kick the user from server.', inline=False)
await ctxt.send(embed=embed)
Since you want to add extra space between 2 fields then that’s a good workaround:
embed.add_field(name='Server Command', value='`p!ping`>>Check the ping from server to bot.n`p!list`>>Check the number of users in the server.', inline=False)
embed.add_field(name = chr(173), value = chr(173))
embed.add_field(name='Users Command', value='`!kick`>>Kick the user from server.', inline=False)
What I did is that I added another field between both of them and I set its name and value to an empty character.
You can enclose your text within triple quotes(''' text '''
) and then use it for the embed.
so your code should look something like this:
value = '''p!ping`>>Check the ping from server to bot.
`p!list`>>Check the number of users in the server.'''
embed.add_field(name='Server Command', value=value, inline=False)
A benefit of this way is that you can also add blank lines in between so that the text looks more aesthetic