Reputation: 131
I have an embed with a long string that breaks the line. Since I am numbering each line the alignment is off. How can I correct this? I used \n to break the line for example purposes
This is currently how the embed looks
I would like to indent the second line to make the text look like:
this is a long
string
My Code:
command(client, 'title' , (message) => {
const embed = new Discord.MessageEmbed()
.setTitle('Title')
.setColor('#C69B6D')
.addFields(
{
name: 'Field' ,
value: "1: this is a long \n string",
inline: true,
},
)
message.channel.send(embed).then(msg => {})
})
Upvotes: 0
Views: 8727
Reputation: 131
So I found a somewhat "fix". If I use a code block; I can then use a string literal and force the line break where the string becomes too long then add spaces.
My embed now looks like
My Updated Code:
command(client, 'title' , (message) => {
const embed = new Discord.MessageEmbed()
.setTitle('Title')
.setColor('#C69B6D')
.addFields(
{
name: 'Field' ,
value: "```1: this is a long \n string```",
inline: true,
},
)
message.channel.send(embed).then(msg => {})
})
Upvotes: 1
Reputation: 2023
What you are trying to do is formally not supported without 'cheating' with spaces. I dont know if the string is of custom length, but if it is a constant string, just add in spaces where necessary:
const embed = new Discord.MessageEmbed()
.setTitle('Title')
.setColor('#C69B6D')
.addFields(
{
name: 'Field' ,
value: "1: this is a long \n string", //adding 4 spaces will indent your string
inline: true,
},
);
I'm thinking of a way you could achieve this with a function that iterates through your string adding spaces where necessary but for what it is, it seems like unnecessary hassle
Upvotes: 1