Fixed ordering.

This commit is contained in:
Sindre G. Langhus
2016-11-25 21:51:01 +01:00
parent d0158816d3
commit 54dd0a5cec
4 changed files with 15 additions and 16 deletions

View File

@@ -49,7 +49,7 @@ namespace Discord.API
{
_restClientProvider = restClientProvider;
_userAgent = userAgent;
_serializer = serializer ?? new JsonSerializer { DateFormatString = "yyyy-MM-ddTHH:mm:ssZ", DateTimeZoneHandling = DateTimeZoneHandling.Utc, ContractResolver = new DiscordContractResolver() };
_serializer = serializer ?? new JsonSerializer { DateFormatString = "yyyy-MM-ddTHH:mm:ssZ", ContractResolver = new DiscordContractResolver() };
RequestQueue = requestQueue;
FetchCurrentUser = true;

View File

@@ -25,8 +25,8 @@ namespace Discord
public string Url { get { return _model.Url; } set { _model.Url = value; } }
public string ThumbnailUrl { get; set; }
public string ImageUrl { get; set; }
public Color? Color { get { return _model.Color.HasValue ? new Color(_model.Color.Value) : (Color?)null; } set { _model.Color = value?.RawValue; } }
public DateTimeOffset? Timestamp { get; set; }
public Color? Color { get { return _model.Color.HasValue ? new Color(_model.Color.Value) : (Color?)null; } set { _model.Color = value?.RawValue; } }
public EmbedAuthorBuilder Author { get; set; }
public EmbedFooterBuilder Footer { get; set; }
@@ -55,11 +55,6 @@ namespace Discord
ImageUrl = ImageUrl;
return this;
}
public EmbedBuilder WithColor(Color color)
{
Color = color;
return this;
}
public EmbedBuilder WithTimestamp()
{
Timestamp = DateTimeOffset.UtcNow;
@@ -70,6 +65,11 @@ namespace Discord
Timestamp = dateTimeOffset;
return this;
}
public EmbedBuilder WithColor(Color color)
{
Color = color;
return this;
}
public EmbedBuilder WithAuthor(EmbedAuthorBuilder author)
{

View File

@@ -9,8 +9,8 @@ namespace Discord
string Type { get; }
string Title { get; }
string Description { get; }
Color? Color { get; }
DateTimeOffset? Timestamp { get; }
Color? Color { get; }
EmbedImage? Image { get; }
EmbedVideo? Video { get; }
EmbedAuthor? Author { get; }

View File

@@ -13,8 +13,8 @@ namespace Discord
public string Url { get; }
public string Title { get; }
public string Type { get; }
public Color? Color { get; }
public DateTimeOffset? Timestamp { get; }
public Color? Color { get; }
public EmbedImage? Image { get; }
public EmbedVideo? Video { get; }
public EmbedAuthor? Author { get; }
@@ -24,11 +24,11 @@ namespace Discord
public ImmutableArray<EmbedField> Fields { get; }
internal Embed(string type,
string title,
string description,
string url,
Color? color,
string title,
string description,
string url,
DateTimeOffset? timestamp,
Color? color,
EmbedImage? image,
EmbedVideo? video,
EmbedAuthor? author,
@@ -53,9 +53,8 @@ namespace Discord
}
internal static Embed Create(Model model)
{
return new Embed(model.Type, model.Title, model.Description, model.Url,
model.Color.HasValue ? new Color(model.Color.Value) : (Color?)null,
model.Timestamp.IsSpecified ? model.Timestamp.Value : (DateTimeOffset?)null,
return new Embed(model.Type, model.Title, model.Description, model.Url,model.Timestamp,
model.Color.HasValue ? new Color(model.Color.Value) : (Color?)null,
model.Image.IsSpecified ? EmbedImage.Create(model.Image.Value) : (EmbedImage?)null,
model.Video.IsSpecified ? EmbedVideo.Create(model.Video.Value) : (EmbedVideo?)null,
model.Author.IsSpecified ? EmbedAuthor.Create(model.Author.Value) : (EmbedAuthor?)null,