mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
REST API speed improvement (#1577)
This commit is contained in:
@@ -205,7 +205,7 @@ class User {
|
||||
*/
|
||||
createDM() {
|
||||
if (this.dmChannel) return Promise.resolve(this.dmChannel);
|
||||
return this.client.api.users(this.client.user.id).channels.post({ data: {
|
||||
return this.client.api.users[this.client.user.id].channels.post({ data: {
|
||||
recipient_id: this.id,
|
||||
} })
|
||||
.then(data => this.client.actions.ChannelCreate.handle(data).channel);
|
||||
@@ -217,7 +217,7 @@ class User {
|
||||
*/
|
||||
deleteDM() {
|
||||
if (!this.dmChannel) return Promise.reject(new Error('No DM Channel exists!'));
|
||||
return this.client.api.channels(this.dmChannel.id).delete().then(data =>
|
||||
return this.client.api.channels[this.dmChannel.id].delete().then(data =>
|
||||
this.client.actions.ChannelDelete.handle(data).channel
|
||||
);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ class User {
|
||||
* @returns {Promise<UserProfile>}
|
||||
*/
|
||||
fetchProfile() {
|
||||
return this.client.api.users(this.id).profile.get().then(data => new UserProfile(data));
|
||||
return this.client.api.users[this.id].profile.get().then(data => new UserProfile(data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,7 +238,7 @@ class User {
|
||||
* @returns {Promise<User>}
|
||||
*/
|
||||
setNote(note) {
|
||||
return this.client.api.users('@me').notes(this.id).put({ data: { note } })
|
||||
return this.client.api.users['@me'].notes[this.id].put({ data: { note } })
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user