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.

EmbedBuilderExtensions.cs 1.3 kB

12345678910111213141516171819202122232425
  1. +using System;
  2. +
  3. +namespace Discord
  4. +{
  5. + public static class EmbedBuilderExtensions
  6. + {
  7. + public static EmbedBuilder WithUrl(this EmbedBuilder builder, string url)
  8. + => Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out var uri) ? builder.WithUrl(uri) : builder;
  9. +
  10. + public static EmbedBuilder WithImageUrl(this EmbedBuilder builder, string url)
  11. + => Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out var uri) ? builder.WithImageUrl(uri) : builder;
  12. +
  13. + public static EmbedBuilder WithThumbnailUrl(this EmbedBuilder builder, string url)
  14. + => Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out var uri) ? builder.WithThumbnailUrl(uri) : builder;
  15. +
  16. + public static EmbedAuthorBuilder WithUrl(this EmbedAuthorBuilder builder, string url)
  17. + => Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out var uri) ? builder.WithUrl(uri) : builder;
  18. +
  19. + public static EmbedAuthorBuilder WithIconUrl(this EmbedAuthorBuilder builder, string url)
  20. + => Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out var uri) ? builder.WithIconUrl(uri) : builder;
  21. +
  22. + public static EmbedFooterBuilder WithIconUrl(this EmbedFooterBuilder builder, string url)
  23. + => Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out var uri) ? builder.WithIconUrl(uri) : builder;
  24. + }
  25. +}