mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +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:
@@ -413,7 +413,7 @@ class Message {
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
pin() {
|
||||
return this.client.api.channels[this.channel.id].pins[this.id].put()
|
||||
return this.client.api.channels(this.channel.id).pins(this.id).put()
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ class Message {
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
unpin() {
|
||||
return this.client.api.channels[this.channel.id].pins[this.id].delete()
|
||||
return this.client.api.channels(this.channel.id).pins(this.id).delete()
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ class Message {
|
||||
emoji = this.client.resolver.resolveEmojiIdentifier(emoji);
|
||||
if (!emoji) throw new TypeError('EMOJI_TYPE');
|
||||
|
||||
return this.client.api.channels[this.channel.id].messages[this.id].reactions[emoji]['@me']
|
||||
return this.client.api.channels(this.channel.id).messages(this.id).reactions(emoji, '@me')
|
||||
.put()
|
||||
.then(() => this._addReaction(Util.parseEmoji(emoji), this.client.user));
|
||||
}
|
||||
@@ -445,7 +445,7 @@ class Message {
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
clearReactions() {
|
||||
return this.client.api.channels[this.channel.id].messages[this.id].reactions.delete()
|
||||
return this.client.api.channels(this.channel.id).messages(this.id).reactions.delete()
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ class Message {
|
||||
*/
|
||||
delete({ timeout = 0, reason } = {}) {
|
||||
if (timeout <= 0) {
|
||||
return this.client.api.channels[this.channel.id].messages[this.id]
|
||||
return this.client.api.channels(this.channel.id).messages(this.id)
|
||||
.delete({ reason })
|
||||
.then(() =>
|
||||
this.client.actions.MessageDelete.handle({
|
||||
@@ -506,7 +506,7 @@ class Message {
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
acknowledge() {
|
||||
return this.client.api.channels[this.channel.id].messages[this.id].ack
|
||||
return this.client.api.channels(this.channel.id).messages(this.id).ack
|
||||
.post({ data: { token: this.client.rest._ackToken } })
|
||||
.then(res => {
|
||||
if (res.token) this.client.rest._ackToken = res.token;
|
||||
|
||||
Reference in New Issue
Block a user