Revert change of all Url types on IEmbed to string (#724)
This commit is contained in:
committed by
RogueException
parent
1ce1c019b3
commit
7837c4862c
@@ -11,7 +11,7 @@ namespace Discord
|
|||||||
public EmbedType Type { get; }
|
public EmbedType Type { get; }
|
||||||
|
|
||||||
public string Description { get; internal set; }
|
public string Description { get; internal set; }
|
||||||
public Uri Url { get; internal set; }
|
public string Url { get; internal set; }
|
||||||
public string Title { get; internal set; }
|
public string Title { get; internal set; }
|
||||||
public DateTimeOffset? Timestamp { get; internal set; }
|
public DateTimeOffset? Timestamp { get; internal set; }
|
||||||
public Color? Color { get; internal set; }
|
public Color? Color { get; internal set; }
|
||||||
@@ -31,7 +31,7 @@ namespace Discord
|
|||||||
internal Embed(EmbedType type,
|
internal Embed(EmbedType type,
|
||||||
string title,
|
string title,
|
||||||
string description,
|
string description,
|
||||||
Uri url,
|
string url,
|
||||||
DateTimeOffset? timestamp,
|
DateTimeOffset? timestamp,
|
||||||
Color? color,
|
Color? color,
|
||||||
EmbedImage? image,
|
EmbedImage? image,
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ namespace Discord
|
|||||||
public struct EmbedAuthor
|
public struct EmbedAuthor
|
||||||
{
|
{
|
||||||
public string Name { get; internal set; }
|
public string Name { get; internal set; }
|
||||||
public Uri Url { get; internal set; }
|
public string Url { get; internal set; }
|
||||||
public Uri IconUrl { get; internal set; }
|
public string IconUrl { get; internal set; }
|
||||||
public Uri ProxyIconUrl { get; internal set; }
|
public string ProxyIconUrl { get; internal set; }
|
||||||
|
|
||||||
internal EmbedAuthor(string name, Uri url, Uri iconUrl, Uri proxyIconUrl)
|
internal EmbedAuthor(string name, string url, string iconUrl, string proxyIconUrl)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Url = url;
|
Url = url;
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ namespace Discord
|
|||||||
public struct EmbedFooter
|
public struct EmbedFooter
|
||||||
{
|
{
|
||||||
public string Text { get; internal set; }
|
public string Text { get; internal set; }
|
||||||
public Uri IconUrl { get; internal set; }
|
public string IconUrl { get; internal set; }
|
||||||
public Uri ProxyUrl { get; internal set; }
|
public string ProxyUrl { get; internal set; }
|
||||||
|
|
||||||
internal EmbedFooter(string text, Uri iconUrl, Uri proxyUrl)
|
internal EmbedFooter(string text, string iconUrl, string proxyUrl)
|
||||||
{
|
{
|
||||||
Text = text;
|
Text = text;
|
||||||
IconUrl = iconUrl;
|
IconUrl = iconUrl;
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ namespace Discord
|
|||||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||||
public struct EmbedImage
|
public struct EmbedImage
|
||||||
{
|
{
|
||||||
public Uri Url { get; }
|
public string Url { get; }
|
||||||
public Uri ProxyUrl { get; }
|
public string ProxyUrl { get; }
|
||||||
public int? Height { get; }
|
public int? Height { get; }
|
||||||
public int? Width { get; }
|
public int? Width { get; }
|
||||||
|
|
||||||
internal EmbedImage(Uri url, Uri proxyUrl, int? height, int? width)
|
internal EmbedImage(string url, string proxyUrl, int? height, int? width)
|
||||||
{
|
{
|
||||||
Url = url;
|
Url = url;
|
||||||
ProxyUrl = proxyUrl;
|
ProxyUrl = proxyUrl;
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace Discord
|
|||||||
public struct EmbedProvider
|
public struct EmbedProvider
|
||||||
{
|
{
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public Uri Url { get; }
|
public string Url { get; }
|
||||||
|
|
||||||
internal EmbedProvider(string name, Uri url)
|
internal EmbedProvider(string name, string url)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Url = url;
|
Url = url;
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ namespace Discord
|
|||||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||||
public struct EmbedThumbnail
|
public struct EmbedThumbnail
|
||||||
{
|
{
|
||||||
public Uri Url { get; }
|
public string Url { get; }
|
||||||
public Uri ProxyUrl { get; }
|
public string ProxyUrl { get; }
|
||||||
public int? Height { get; }
|
public int? Height { get; }
|
||||||
public int? Width { get; }
|
public int? Width { get; }
|
||||||
|
|
||||||
internal EmbedThumbnail(Uri url, Uri proxyUrl, int? height, int? width)
|
internal EmbedThumbnail(string url, string proxyUrl, int? height, int? width)
|
||||||
{
|
{
|
||||||
Url = url;
|
Url = url;
|
||||||
ProxyUrl = proxyUrl;
|
ProxyUrl = proxyUrl;
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ namespace Discord
|
|||||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||||
public struct EmbedVideo
|
public struct EmbedVideo
|
||||||
{
|
{
|
||||||
public Uri Url { get; }
|
public string Url { get; }
|
||||||
public int? Height { get; }
|
public int? Height { get; }
|
||||||
public int? Width { get; }
|
public int? Width { get; }
|
||||||
|
|
||||||
internal EmbedVideo(Uri url, int? height, int? width)
|
internal EmbedVideo(string url, int? height, int? width)
|
||||||
{
|
{
|
||||||
Url = url;
|
Url = url;
|
||||||
Height = height;
|
Height = height;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
public interface IEmbed
|
public interface IEmbed
|
||||||
{
|
{
|
||||||
Uri Url { get; }
|
string Url { get; }
|
||||||
string Title { get; }
|
string Title { get; }
|
||||||
string Description { get; }
|
string Description { get; }
|
||||||
EmbedType Type { get; }
|
EmbedType Type { get; }
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Discord.API
|
|||||||
[JsonProperty("description")]
|
[JsonProperty("description")]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
[JsonProperty("url")]
|
[JsonProperty("url")]
|
||||||
public Uri Url { get; set; }
|
public string Url { get; set; }
|
||||||
[JsonProperty("color")]
|
[JsonProperty("color")]
|
||||||
public uint? Color { get; set; }
|
public uint? Color { get; set; }
|
||||||
[JsonProperty("type"), JsonConverter(typeof(StringEnumConverter))]
|
[JsonProperty("type"), JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ namespace Discord.API
|
|||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[JsonProperty("url")]
|
[JsonProperty("url")]
|
||||||
public Uri Url { get; set; }
|
public string Url { get; set; }
|
||||||
[JsonProperty("icon_url")]
|
[JsonProperty("icon_url")]
|
||||||
public Uri IconUrl { get; set; }
|
public string IconUrl { get; set; }
|
||||||
[JsonProperty("proxy_icon_url")]
|
[JsonProperty("proxy_icon_url")]
|
||||||
public Uri ProxyIconUrl { get; set; }
|
public string ProxyIconUrl { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ namespace Discord.API
|
|||||||
[JsonProperty("text")]
|
[JsonProperty("text")]
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
[JsonProperty("icon_url")]
|
[JsonProperty("icon_url")]
|
||||||
public Uri IconUrl { get; set; }
|
public string IconUrl { get; set; }
|
||||||
[JsonProperty("proxy_icon_url")]
|
[JsonProperty("proxy_icon_url")]
|
||||||
public Uri ProxyIconUrl { get; set; }
|
public string ProxyIconUrl { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace Discord.API
|
|||||||
internal class EmbedImage
|
internal class EmbedImage
|
||||||
{
|
{
|
||||||
[JsonProperty("url")]
|
[JsonProperty("url")]
|
||||||
public Uri Url { get; set; }
|
public string Url { get; set; }
|
||||||
[JsonProperty("proxy_url")]
|
[JsonProperty("proxy_url")]
|
||||||
public Uri ProxyUrl { get; set; }
|
public string ProxyUrl { get; set; }
|
||||||
[JsonProperty("height")]
|
[JsonProperty("height")]
|
||||||
public Optional<int> Height { get; set; }
|
public Optional<int> Height { get; set; }
|
||||||
[JsonProperty("width")]
|
[JsonProperty("width")]
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ namespace Discord.API
|
|||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
[JsonProperty("url")]
|
[JsonProperty("url")]
|
||||||
public Uri Url { get; set; }
|
public string Url { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ namespace Discord.API
|
|||||||
internal class EmbedThumbnail
|
internal class EmbedThumbnail
|
||||||
{
|
{
|
||||||
[JsonProperty("url")]
|
[JsonProperty("url")]
|
||||||
public Uri Url { get; set; }
|
public string Url { get; set; }
|
||||||
[JsonProperty("proxy_url")]
|
[JsonProperty("proxy_url")]
|
||||||
public Uri ProxyUrl { get; set; }
|
public string ProxyUrl { get; set; }
|
||||||
[JsonProperty("height")]
|
[JsonProperty("height")]
|
||||||
public Optional<int> Height { get; set; }
|
public Optional<int> Height { get; set; }
|
||||||
[JsonProperty("width")]
|
[JsonProperty("width")]
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Discord.API
|
|||||||
internal class EmbedVideo
|
internal class EmbedVideo
|
||||||
{
|
{
|
||||||
[JsonProperty("url")]
|
[JsonProperty("url")]
|
||||||
public Uri Url { get; set; }
|
public string Url { get; set; }
|
||||||
[JsonProperty("height")]
|
[JsonProperty("height")]
|
||||||
public Optional<int> Height { get; set; }
|
public Optional<int> Height { get; set; }
|
||||||
[JsonProperty("width")]
|
[JsonProperty("width")]
|
||||||
|
|||||||
@@ -39,9 +39,33 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Uri Url { get => _embed.Url; set { _embed.Url = value; } }
|
public string Url
|
||||||
public Uri ThumbnailUrl { get => _embed.Thumbnail?.Url; set { _embed.Thumbnail = new EmbedThumbnail(value, null, null, null); } }
|
{
|
||||||
public Uri ImageUrl { get => _embed.Image?.Url; set { _embed.Image = new EmbedImage(value, null, null, null); } }
|
get => _embed.Url;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!Uri.IsWellFormedUriString(value, UriKind.Absolute)) throw new ArgumentException("Url must be a well-formed URI", nameof(Url));
|
||||||
|
_embed.Url = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string ThumbnailUrl
|
||||||
|
{
|
||||||
|
get => _embed.Thumbnail?.Url;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!Uri.IsWellFormedUriString(value, UriKind.Absolute)) throw new ArgumentException("Url must be a well-formed URI", nameof(ThumbnailUrl));
|
||||||
|
_embed.Thumbnail = new EmbedThumbnail(value, null, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string ImageUrl
|
||||||
|
{
|
||||||
|
get => _embed.Image?.Url;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!Uri.IsWellFormedUriString(value, UriKind.Absolute)) throw new ArgumentException("Url must be a well-formed URI", nameof(ImageUrl));
|
||||||
|
_embed.Image = new EmbedImage(value, null, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
public DateTimeOffset? Timestamp { get => _embed.Timestamp; set { _embed.Timestamp = value; } }
|
public DateTimeOffset? Timestamp { get => _embed.Timestamp; set { _embed.Timestamp = value; } }
|
||||||
public Color? Color { get => _embed.Color; set { _embed.Color = value; } }
|
public Color? Color { get => _embed.Color; set { _embed.Color = value; } }
|
||||||
|
|
||||||
@@ -70,17 +94,17 @@ namespace Discord
|
|||||||
Description = description;
|
Description = description;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public EmbedBuilder WithUrl(Uri url)
|
public EmbedBuilder WithUrl(string url)
|
||||||
{
|
{
|
||||||
Url = url;
|
Url = url;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public EmbedBuilder WithThumbnailUrl(Uri thumbnailUrl)
|
public EmbedBuilder WithThumbnailUrl(string thumbnailUrl)
|
||||||
{
|
{
|
||||||
ThumbnailUrl = thumbnailUrl;
|
ThumbnailUrl = thumbnailUrl;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public EmbedBuilder WithImageUrl(Uri imageUrl)
|
public EmbedBuilder WithImageUrl(string imageUrl)
|
||||||
{
|
{
|
||||||
ImageUrl = imageUrl;
|
ImageUrl = imageUrl;
|
||||||
return this;
|
return this;
|
||||||
@@ -252,8 +276,24 @@ namespace Discord
|
|||||||
_author.Name = value;
|
_author.Name = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Uri Url { get => _author.Url; set { _author.Url = value; } }
|
public string Url
|
||||||
public Uri IconUrl { get => _author.IconUrl; set { _author.IconUrl = value; } }
|
{
|
||||||
|
get => _author.Url;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!Uri.IsWellFormedUriString(value, UriKind.Absolute)) throw new ArgumentException("Url must be a well-formed URI", nameof(Url));
|
||||||
|
_author.Url = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string IconUrl
|
||||||
|
{
|
||||||
|
get => _author.IconUrl;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!Uri.IsWellFormedUriString(value, UriKind.Absolute)) throw new ArgumentException("Url must be a well-formed URI", nameof(IconUrl));
|
||||||
|
_author.IconUrl = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public EmbedAuthorBuilder()
|
public EmbedAuthorBuilder()
|
||||||
{
|
{
|
||||||
@@ -265,12 +305,12 @@ namespace Discord
|
|||||||
Name = name;
|
Name = name;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public EmbedAuthorBuilder WithUrl(Uri url)
|
public EmbedAuthorBuilder WithUrl(string url)
|
||||||
{
|
{
|
||||||
Url = url;
|
Url = url;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public EmbedAuthorBuilder WithIconUrl(Uri iconUrl)
|
public EmbedAuthorBuilder WithIconUrl(string iconUrl)
|
||||||
{
|
{
|
||||||
IconUrl = iconUrl;
|
IconUrl = iconUrl;
|
||||||
return this;
|
return this;
|
||||||
@@ -295,7 +335,15 @@ namespace Discord
|
|||||||
_footer.Text = value;
|
_footer.Text = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public Uri IconUrl { get => _footer.IconUrl; set { _footer.IconUrl = value; } }
|
public string IconUrl
|
||||||
|
{
|
||||||
|
get => _footer.IconUrl;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!Uri.IsWellFormedUriString(value, UriKind.Absolute)) throw new ArgumentException("Url must be a well-formed URI", nameof(IconUrl));
|
||||||
|
_footer.IconUrl = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public EmbedFooterBuilder()
|
public EmbedFooterBuilder()
|
||||||
{
|
{
|
||||||
@@ -307,7 +355,7 @@ namespace Discord
|
|||||||
Text = text;
|
Text = text;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public EmbedFooterBuilder WithIconUrl(Uri iconUrl)
|
public EmbedFooterBuilder WithIconUrl(string iconUrl)
|
||||||
{
|
{
|
||||||
IconUrl = iconUrl;
|
IconUrl = iconUrl;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
Reference in New Issue
Block a user