-1

I've been looking for this but I cannot seem to find the answer. What I want to accomplish is the following:

Right now when I reply with my embed it shows for example: footbal,baseball

But what I want it to be is the following:

football,

baseball

Spread over 2 different lines.

Does anyone know how to do this with text Code? Thank you in advance

Here is the code:

        var value = "";
        int price = 0;
        foreach (var Item in content)
        {

            value += Item.Item1 + ": " + Item.Item2.ToString();
            price += Item.Item2;
        }

        return new EmbedFieldBuilder()
        {
            Name = category + "  - " + price,
            Value = value
        };
  • Please can you share the code that you have so far? – Luke May 30 '21 at 14:27
  • Please can you provide enough code to reproduce the issue? – Luke May 30 '21 at 15:12
  • What do you mean? this is more than enough, I just got to know how to go to the next line in a discord field embed? – Juan Ming Lao May 30 '21 at 15:36
  • I mean please [provide a piece of code that can be run that will produce the output that you said it would](https://stackoverflow.com/help/minimal-reproducible-example). I see no mention of `footbal` or `baseball` in your example, or any commas. – Luke May 30 '21 at 15:40
  • Does this answer your question? [Adding a newline into a string in C#](https://stackoverflow.com/questions/224236/adding-a-newline-into-a-string-in-c-sharp) – Luke May 30 '21 at 15:43

1 Answers1

1

Worked for me with simple "\n" or Environment.NewLine:

var embed = new EmbedBuilder
{
    Author = new EmbedAuthorBuilder() { Name = "AuthorNameHere" },
    Title = "Sports",
    Color = Color.Orange,
    Description = "Football" + "\n\n" + "Baseball"
}.Build();

//var channel = GetYourNeededChannel(); 
await channel.SendMessageAsync("", false, embed);

Result

Also works with fields in embed:

Fields = new List<EmbedFieldBuilder>() 
{
    new EmbedFieldBuilder() 
    { 
       Name = "TestField1", 
       Value = "FieldValue1" + "\n\n" + "FieldValue2"
    }
}

Result2

Auditive
  • 1,607
  • 1
  • 7
  • 13