Fixed avatar uploading
This commit is contained in:
@@ -107,7 +107,7 @@ namespace Discord.API
|
|||||||
public string CurrentPassword;
|
public string CurrentPassword;
|
||||||
[JsonProperty(PropertyName = "email", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty(PropertyName = "email", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Email;
|
public string Email;
|
||||||
[JsonProperty(PropertyName = "new_password", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty(PropertyName = "new_password")]
|
||||||
public string Password;
|
public string Password;
|
||||||
[JsonProperty(PropertyName = "username", NullValueHandling = NullValueHandling.Ignore)]
|
[JsonProperty(PropertyName = "username", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
public string Username;
|
public string Username;
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ namespace Discord
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile
|
//Profile
|
||||||
public Task<EditProfileResponse> EditProfile(string currentPassword,
|
public Task<EditProfileResponse> EditProfile(string currentPassword = "",
|
||||||
string username = null, string email = null, string password = null,
|
string username = null, string email = null, string password = null,
|
||||||
AvatarImageType avatarType = AvatarImageType.Png, byte[] avatar = null)
|
AvatarImageType avatarType = AvatarImageType.Png, byte[] avatar = null)
|
||||||
{
|
{
|
||||||
@@ -231,7 +231,7 @@ namespace Discord
|
|||||||
{
|
{
|
||||||
string base64 = Convert.ToBase64String(avatar);
|
string base64 = Convert.ToBase64String(avatar);
|
||||||
string type = avatarType == AvatarImageType.Jpeg ? "image/jpeg;base64" : "image/png;base64";
|
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 };
|
var request = new EditProfileRequest { CurrentPassword = currentPassword, Username = username, Email = email, Password = password, Avatar = avatarBase64 };
|
||||||
return _rest.Patch<EditProfileResponse>(Endpoints.UserMe, request);
|
return _rest.Patch<EditProfileResponse>(Endpoints.UserMe, request);
|
||||||
|
|||||||
Reference in New Issue
Block a user