Browse Source

Add Embed Video Structure into EmbedBuilder

pull/926/head
Acid Chicken (硫酸鶏) 7 years ago
parent
commit
28d44d586d
No known key found for this signature in database GPG Key ID: E292DBE5D23A5846
2 changed files with 16 additions and 1 deletions
  1. +14
    -0
      src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs
  2. +2
    -1
      src/Discord.Net.Rest/Extensions/EmbedBuilderExtensions.cs

+ 14
- 0
src/Discord.Net.Rest/Entities/Messages/EmbedBuilder.cs View File

@@ -66,6 +66,15 @@ namespace Discord
_embed.Image = new EmbedImage(value, null, null, null);
}
}
public string VideoUrl
{
get => _embed.Video?.Url;
set
{
if (!value.IsNullOrUri()) throw new ArgumentException("Url must be a well-formed URI", nameof(VideoUrl));
_embed.Video = new EmbedVideo(value, null, null);
}
}
public DateTimeOffset? Timestamp { get => _embed.Timestamp; set { _embed.Timestamp = value; } }
public Color? Color { get => _embed.Color; set { _embed.Color = value; } }

@@ -110,6 +119,11 @@ namespace Discord
ImageUrl = imageUrl;
return this;
}
public EmbedBuilder WithVideoUrl(string videoUrl)
{
VideoUrl = videoUrl;
return this;
}
public EmbedBuilder WithCurrentTimestamp()
{
Timestamp = DateTimeOffset.UtcNow;


+ 2
- 1
src/Discord.Net.Rest/Extensions/EmbedBuilderExtensions.cs View File

@@ -51,7 +51,8 @@ namespace Discord
ThumbnailUrl = embed.Thumbnail?.Url,
Timestamp = embed.Timestamp,
Title = embed.Title,
Url = embed.Url
Url = embed.Url,
VideoUrl = embed.Video?.Url
};

foreach (var field in embed.Fields)


Loading…
Cancel
Save