mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Added updateDetails and setUsername
This commit is contained in:
@@ -982,6 +982,33 @@ var InternalClient = (function () {
|
||||
});
|
||||
};
|
||||
|
||||
//def updateDetails
|
||||
|
||||
InternalClient.prototype.updateDetails = function updateDetails(data) {
|
||||
var self = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
request.patch(Endpoints.ME).set("authorization", self.token).send({
|
||||
avatar: data.avatar || self.user.avatar,
|
||||
email: data.email || self.email,
|
||||
new_password: data.new_password || null,
|
||||
password: data.password || self.password,
|
||||
username: data.username || self.user.username
|
||||
}).end(function (err) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
//def setUsername
|
||||
|
||||
InternalClient.prototype.setUsername = function setUsername(username) {
|
||||
return this.updateDetails({ username: username });
|
||||
};
|
||||
|
||||
//def setTopic
|
||||
|
||||
InternalClient.prototype.setTopic = function setTopic(chann) {
|
||||
|
||||
Reference in New Issue
Block a user