mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
backport: rateLimitPerUser (#2874)
This commit is contained in:
@@ -331,6 +331,8 @@ class RESTMethods {
|
||||
data.parent_id = _data.parent;
|
||||
data.permission_overwrites = _data.permissionOverwrites ?
|
||||
resolvePermissions.call(this, _data.permissionOverwrites, channel.guild) : undefined;
|
||||
data.rate_limit_per_user = typeof _data.rateLimitPerUser !== 'undefined' ?
|
||||
_data.rateLimitPerUser : channel.rateLimitPerUser;
|
||||
return this.rest.makeRequest('patch', Endpoints.Channel(channel), true, data, undefined, reason).then(newData =>
|
||||
this.client.actions.ChannelUpdate.handle(newData).updated
|
||||
);
|
||||
|
||||
@@ -36,6 +36,12 @@ class TextChannel extends GuildChannel {
|
||||
* @type {?Snowflake}
|
||||
*/
|
||||
this.lastMessageID = data.last_message_id;
|
||||
|
||||
/**
|
||||
* The ratelimit per user for this channel
|
||||
* @type {number}
|
||||
*/
|
||||
this.rateLimitPerUser = data.rate_limit_per_user || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,6 +103,16 @@ class TextChannel extends GuildChannel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rate limit per user for this channel.
|
||||
* @param {number} rateLimitPerUser The new ratelimit
|
||||
* @param {string} [reason] Reason for changing the channel's ratelimits
|
||||
* @returns {Promise<TextChannel>}
|
||||
*/
|
||||
setRateLimitPerUser(rateLimitPerUser, reason) {
|
||||
return this.edit({ rateLimitPerUser }, reason);
|
||||
}
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
/* eslint-disable no-empty-function */
|
||||
send() { }
|
||||
|
||||
Reference in New Issue
Block a user