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.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. uid: Discord.EmbedBuilder
  3. remarks: *content
  4. ---
  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. ---
  9. uid: Discord.EmbedBuilder
  10. example: [*content]
  11. ---
  12. The example below builds an embed and sends it to the chat.
  13. ```cs
  14. [Command("embed")]
  15. public async Task SendRichEmbedAsync()
  16. {
  17. var embed = new EmbedBuilder
  18. {
  19. // Embed property can be set within object initializer
  20. Title = "Hello world!"
  21. }
  22. // Or with methods
  23. .AddField("Field title",
  24. "Field value. I also support [hyperlink markdown](https://example.com)!")
  25. .WithAuthor(Context.Client.CurrentUser)
  26. .WithFooter(footer => footer.Text = "I am a footer.")
  27. .WithColor(Color.Blue)
  28. .WithTitle("I overwrote \"Hello world!\"")
  29. .WithDescription("I am a description.")
  30. .WithUrl("https://example.com")
  31. .WithCurrentTimestamp()
  32. .Build();
  33. await ReplyAsync(embed: embed);
  34. }
  35. ```
  36. #### Result
  37. ![Embed Example](images/embed-example.png)