You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Discord.EmbedBuilder.Overwrites.md 1.1 kB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ---
  2. uid: Discord.EmbedBuilder
  3. ---
  4. ### Remarks
  5. This builder class is used to build an @Discord.Embed (rich embed)
  6. object that will be ready to be sent via @Discord.IMessageChannel.SendMessageAsync*
  7. after @Discord.EmbedBuilder.Build* is called.
  8. ### Example
  9. The example below builds an embed and sends it to the chat.
  10. ```cs
  11. [Command("embed")]
  12. public async Task SendRichEmbedAsync()
  13. {
  14. var embed = new EmbedBuilder
  15. {
  16. // Embed property can be set within object initializer
  17. Title = "Hello world!"
  18. }
  19. // Or with methods
  20. .AddField("Field title",
  21. "Field value. I also support [hyperlink markdown](https://example.com)!")
  22. .WithAuthor(Context.Client.CurrentUser)
  23. .WithFooter(footer => footer.Text = "I am a footer.")
  24. .WithColor(Color.Blue)
  25. .WithTitle("I overwrote \"Hello world!\"")
  26. .WithDescription("I am a description.")
  27. .WithUrl("https://example.com")
  28. .WithCurrentTimestamp()
  29. .Build();
  30. await ReplyAsync(embed: embed);
  31. }
  32. ```
  33. #### Result
  34. ![Embed Example](images/embed-example.png)