Fixed avatar uploading

This commit is contained in:
RogueException
2015-09-26 23:26:40 -03:00
parent a8ca994667
commit 4710225035
2 changed files with 3 additions and 3 deletions

View File

@@ -107,7 +107,7 @@ namespace Discord.API
public string CurrentPassword;
[JsonProperty(PropertyName = "email", NullValueHandling = NullValueHandling.Ignore)]
public string Email;
[JsonProperty(PropertyName = "new_password", NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty(PropertyName = "new_password")]
public string Password;
[JsonProperty(PropertyName = "username", NullValueHandling = NullValueHandling.Ignore)]
public string Username;

View File

@@ -220,7 +220,7 @@ namespace Discord
}
//Profile
public Task<EditProfileResponse> EditProfile(string currentPassword,
public Task<EditProfileResponse> EditProfile(string currentPassword = "",
string username = null, string email = null, string password = null,
AvatarImageType avatarType = AvatarImageType.Png, byte[] avatar = null)
{
@@ -231,7 +231,7 @@ namespace Discord
{
string base64 = Convert.ToBase64String(avatar);
string type = avatarType == AvatarImageType.Jpeg ? "image/jpeg;base64" : "image/png;base64";
avatarBase64 = $"data:{type},/9j/{base64}";
avatarBase64 = $"data:{type},{base64}";
}
var request = new EditProfileRequest { CurrentPassword = currentPassword, Username = username, Email = email, Password = password, Avatar = avatarBase64 };
return _rest.Patch<EditProfileResponse>(Endpoints.UserMe, request);