Browse Source

Fixed avatar uploading

tags/docs-0.9
RogueException 9 years ago
parent
commit
4710225035
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      src/Discord.Net/API/Requests.cs
  2. +2
    -2
      src/Discord.Net/DiscordAPIClient.cs

+ 1
- 1
src/Discord.Net/API/Requests.cs 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;


+ 2
- 2
src/Discord.Net/DiscordAPIClient.cs 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);


Loading…
Cancel
Save