mirror of
https://github.com/danbulant/discord.js
synced 2026-06-22 00:02:13 +00:00
Add email and password if non-token login
This commit is contained in:
parent
4386daf7a0
commit
72340845e5
2 changed files with 20 additions and 22 deletions
|
|
@ -1219,19 +1219,18 @@ var InternalClient = (function () {
|
|||
//def updateDetails
|
||||
|
||||
InternalClient.prototype.updateDetails = function updateDetails(data) {
|
||||
if (!this.email && !data.email) {
|
||||
return this.apiRequest("patch", _Constants.Endpoints.ME, true, {
|
||||
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
|
||||
username: data.username || this.user.username
|
||||
});
|
||||
}
|
||||
return this.apiRequest("patch", _Constants.Endpoints.ME, true, {
|
||||
var options = {
|
||||
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
|
||||
email: data.email || this.email,
|
||||
new_password: data.newPassword || null,
|
||||
password: data.password || this.password,
|
||||
username: data.username || this.user.username
|
||||
});
|
||||
};
|
||||
|
||||
if (this.email || data.email) {
|
||||
options.email = data.email || this.email;
|
||||
options.new_password = data.newPassword || null;
|
||||
options.password = data.password || this.password;
|
||||
}
|
||||
|
||||
return this.apiRequest("patch", _Constants.Endpoints.ME, true, options);
|
||||
};
|
||||
|
||||
//def setAvatar
|
||||
|
|
|
|||
|
|
@ -1005,19 +1005,18 @@ export default class InternalClient {
|
|||
|
||||
//def updateDetails
|
||||
updateDetails(data) {
|
||||
if (!this.email && !data.email) {
|
||||
return this.apiRequest("patch", Endpoints.ME, true, {
|
||||
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
|
||||
username: data.username || this.user.username
|
||||
});
|
||||
}
|
||||
return this.apiRequest("patch", Endpoints.ME, true, {
|
||||
var options = {
|
||||
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
|
||||
email: data.email || this.email,
|
||||
new_password: data.newPassword || null,
|
||||
password: data.password || this.password,
|
||||
username: data.username || this.user.username
|
||||
});
|
||||
}
|
||||
|
||||
if (this.email || data.email) {
|
||||
options.email = data.email || this.email;
|
||||
options.new_password = data.newPassword || null;
|
||||
options.password = data.password || this.password;
|
||||
}
|
||||
|
||||
return this.apiRequest("patch", Endpoints.ME, true, options);
|
||||
}
|
||||
|
||||
//def setAvatar
|
||||
|
|
|
|||
Loading…
Reference in a new issue