mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
Add email and password if non-token login
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user