mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13: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
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user