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.

Embed.cs 1.3 kB

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Diagnostics;
  2. using Model = Discord.API.Embed;
  3. namespace Discord
  4. {
  5. [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
  6. public class Embed : IEmbed
  7. {
  8. public string Description { get; }
  9. public string Url { get; }
  10. public string Title { get; }
  11. public string Type { get; }
  12. public EmbedProvider? Provider { get; }
  13. public EmbedThumbnail? Thumbnail { get; }
  14. internal Embed(string type, string title, string description, string url, EmbedProvider? provider, EmbedThumbnail? thumbnail)
  15. {
  16. Type = type;
  17. Title = title;
  18. Description = description;
  19. Url = url;
  20. Provider = provider;
  21. Thumbnail = thumbnail;
  22. }
  23. internal static Embed Create(Model model)
  24. {
  25. return new Embed(model.Type, model.Title, model.Description, model.Url,
  26. model.Provider.IsSpecified ? EmbedProvider.Create(model.Provider.Value) : (EmbedProvider?)null,
  27. model.Thumbnail.IsSpecified ? EmbedThumbnail.Create(model.Thumbnail.Value) : (EmbedThumbnail?)null);
  28. }
  29. public override string ToString() => Title;
  30. private string DebuggerDisplay => $"{Title} ({Type})";
  31. }
  32. }