简体   繁体   中英

Discord.Net how to go to the next line in an embed with text formatting?

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
        };

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);

结果

Also works with fields in embed:

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

结果2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM