mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
feat(GuildChannelStore): support for create with rateLimitPerUser (#2878)
* change GuildChannelStore#create * document rateLimitPerUser * update typings
This commit is contained in:
@@ -33,6 +33,7 @@ class GuildChannelStore extends DataStore {
|
|||||||
* @param {ChannelResolvable} [options.parent] Parent of the new channel
|
* @param {ChannelResolvable} [options.parent] Parent of the new channel
|
||||||
* @param {OverwriteResolvable[]|Collection<Snowflake, OverwriteResolvable>} [options.overwrites]
|
* @param {OverwriteResolvable[]|Collection<Snowflake, OverwriteResolvable>} [options.overwrites]
|
||||||
* Permission overwrites of the new channel
|
* Permission overwrites of the new channel
|
||||||
|
* @param {number} [options.rateLimitPerUser] The ratelimit per user for the channel
|
||||||
* @param {string} [options.reason] Reason for creating the channel
|
* @param {string} [options.reason] Reason for creating the channel
|
||||||
* @returns {Promise<GuildChannel>}
|
* @returns {Promise<GuildChannel>}
|
||||||
* @example
|
* @example
|
||||||
@@ -52,7 +53,7 @@ class GuildChannelStore extends DataStore {
|
|||||||
* ],
|
* ],
|
||||||
* })
|
* })
|
||||||
*/
|
*/
|
||||||
async create(name, { type, topic, nsfw, bitrate, userLimit, parent, overwrites, reason } = {}) {
|
async create(name, { type, topic, nsfw, bitrate, userLimit, parent, overwrites, rateLimitPerUser, reason } = {}) {
|
||||||
if (parent) parent = this.client.channels.resolveID(parent);
|
if (parent) parent = this.client.channels.resolveID(parent);
|
||||||
|
|
||||||
const data = await this.client.api.guilds(this.guild.id).channels.post({
|
const data = await this.client.api.guilds(this.guild.id).channels.post({
|
||||||
@@ -65,6 +66,7 @@ class GuildChannelStore extends DataStore {
|
|||||||
user_limit: userLimit,
|
user_limit: userLimit,
|
||||||
parent_id: parent,
|
parent_id: parent,
|
||||||
permission_overwrites: overwrites && overwrites.map(o => PermissionOverwrites.resolve(o, this.guild)),
|
permission_overwrites: overwrites && overwrites.map(o => PermissionOverwrites.resolve(o, this.guild)),
|
||||||
|
rate_limit_per_user: rateLimitPerUser,
|
||||||
},
|
},
|
||||||
reason,
|
reason,
|
||||||
});
|
});
|
||||||
|
|||||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -1751,6 +1751,7 @@ declare module 'discord.js' {
|
|||||||
userLimit?: number;
|
userLimit?: number;
|
||||||
parent?: ChannelResolvable;
|
parent?: ChannelResolvable;
|
||||||
overwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
|
overwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
|
||||||
|
rateLimitPerUser?: number;
|
||||||
reason?: string
|
reason?: string
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user