mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
rewrite ratelimiting and api route builder (#1667)
* rewrite ratelimiting and api route builder * more stuff * let people pass their own handlers * Update burst.js * Update RequestHandler.js * Update burst.js * Update sequential.js * Update RequestHandler.js
This commit is contained in:
@@ -202,7 +202,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);
|
||||
@@ -214,7 +214,7 @@ class User {
|
||||
*/
|
||||
deleteDM() {
|
||||
if (!this.dmChannel) return Promise.reject(new Error('USER_NO_DMCHANNEL'));
|
||||
return this.client.api.channels[this.dmChannel.id].delete()
|
||||
return this.client.api.channels(this.dmChannel.id).delete()
|
||||
.then(data => this.client.actions.ChannelDelete.handle(data).channel);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ class User {
|
||||
* @returns {Promise<UserProfile>}
|
||||
*/
|
||||
fetchProfile() {
|
||||
return this.client.api.users[this.id].profile.get().then(data => new UserProfile(this, data));
|
||||
return this.client.api.users(this.id).profile.get().then(data => new UserProfile(this, data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,7 +234,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