mirror of
https://github.com/danbulant/discord.js
synced 2026-07-06 03:31:03 +00:00
Added ability to use updateDetails() with token
This commit is contained in:
parent
204bdca555
commit
4386daf7a0
2 changed files with 8 additions and 2 deletions
|
|
@ -1220,7 +1220,10 @@ var InternalClient = (function () {
|
||||||
|
|
||||||
InternalClient.prototype.updateDetails = function updateDetails(data) {
|
InternalClient.prototype.updateDetails = function updateDetails(data) {
|
||||||
if (!this.email && !data.email) {
|
if (!this.email && !data.email) {
|
||||||
throw new Error("Can't use updateDetails because only a token has been used for login!");
|
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, {
|
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,
|
||||||
|
|
|
||||||
|
|
@ -1006,7 +1006,10 @@ export default class InternalClient {
|
||||||
//def updateDetails
|
//def updateDetails
|
||||||
updateDetails(data) {
|
updateDetails(data) {
|
||||||
if (!this.email && !data.email) {
|
if (!this.email && !data.email) {
|
||||||
throw new Error("Can't use updateDetails because only a token has been used for login!");
|
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, {
|
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,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue