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; _restClientProvider = restClientProvider;
_userAgent = userAgent; _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; RequestQueue = requestQueue;
FetchCurrentUser = true; FetchCurrentUser = true;

View File

@@ -25,8 +25,8 @@ namespace Discord
public string Url { get { return _model.Url; } set { _model.Url = value; } } public string Url { get { return _model.Url; } set { _model.Url = value; } }
public string ThumbnailUrl { get; set; } public string ThumbnailUrl { get; set; }
public string ImageUrl { 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 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 EmbedAuthorBuilder Author { get; set; }
public EmbedFooterBuilder Footer { get; set; } public EmbedFooterBuilder Footer { get; set; }
@@ -55,11 +55,6 @@ namespace Discord
ImageUrl = ImageUrl; ImageUrl = ImageUrl;
return this; return this;
} }
public EmbedBuilder WithColor(Color color)
{
Color = color;
return this;
}
public EmbedBuilder WithTimestamp() public EmbedBuilder WithTimestamp()
{ {
Timestamp = DateTimeOffset.UtcNow; Timestamp = DateTimeOffset.UtcNow;
@@ -70,6 +65,11 @@ namespace Discord
Timestamp = dateTimeOffset; Timestamp = dateTimeOffset;
return this; return this;
} }
public EmbedBuilder WithColor(Color color)
{
Color = color;
return this;
}
public EmbedBuilder WithAuthor(EmbedAuthorBuilder author) public EmbedBuilder WithAuthor(EmbedAuthorBuilder author)
{ {

View File

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

View File

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