mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 20:51:14 +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
|
//def updateDetails
|
||||||
|
|
||||||
InternalClient.prototype.updateDetails = function updateDetails(data) {
|
InternalClient.prototype.updateDetails = function updateDetails(data) {
|
||||||
if (!this.email && !data.email) {
|
var options = {
|
||||||
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, {
|
|
||||||
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
|
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
|
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
|
//def setAvatar
|
||||||
|
|
|
||||||
|
|
@ -1005,19 +1005,18 @@ export default class InternalClient {
|
||||||
|
|
||||||
//def updateDetails
|
//def updateDetails
|
||||||
updateDetails(data) {
|
updateDetails(data) {
|
||||||
if (!this.email && !data.email) {
|
var options = {
|
||||||
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, {
|
|
||||||
avatar: this.resolver.resolveToBase64(data.avatar) || this.user.avatar,
|
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
|
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
|
//def setAvatar
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue