v2.2.0
Discord.js v13.8.0
This commit is contained in:
@@ -331,6 +331,64 @@ class TextBasedChannel {
|
||||
throw new TypeError('MESSAGE_BULK_DELETE_TYPE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches all webhooks for the channel.
|
||||
* @returns {Promise<Collection<Snowflake, Webhook>>}
|
||||
* @example
|
||||
* // Fetch webhooks
|
||||
* channel.fetchWebhooks()
|
||||
* .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
fetchWebhooks() {
|
||||
return this.guild.channels.fetchWebhooks(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Options used to create a {@link Webhook} in a guild text-based channel.
|
||||
* @typedef {Object} ChannelWebhookCreateOptions
|
||||
* @property {?(BufferResolvable|Base64Resolvable)} [avatar] Avatar for the webhook
|
||||
* @property {string} [reason] Reason for creating the webhook
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a webhook for the channel.
|
||||
* @param {string} name The name of the webhook
|
||||
* @param {ChannelWebhookCreateOptions} [options] Options for creating the webhook
|
||||
* @returns {Promise<Webhook>} Returns the created Webhook
|
||||
* @example
|
||||
* // Create a webhook for the current channel
|
||||
* channel.createWebhook('Snek', {
|
||||
* avatar: 'https://i.imgur.com/mI8XcpG.jpg',
|
||||
* reason: 'Needed a cool new Webhook'
|
||||
* })
|
||||
* .then(console.log)
|
||||
* .catch(console.error)
|
||||
*/
|
||||
createWebhook(name, options = {}) {
|
||||
return this.guild.channels.createWebhook(this.id, name, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rate limit per user (slowmode) for this channel.
|
||||
* @param {number} rateLimitPerUser The new rate limit in seconds
|
||||
* @param {string} [reason] Reason for changing the channel's rate limit
|
||||
* @returns {Promise<this>}
|
||||
*/
|
||||
setRateLimitPerUser(rateLimitPerUser, reason) {
|
||||
return this.edit({ rateLimitPerUser }, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this channel is flagged as NSFW.
|
||||
* @param {boolean} [nsfw=true] Whether the channel should be considered NSFW
|
||||
* @param {string} [reason] Reason for changing the channel's NSFW flag
|
||||
* @returns {Promise<this>}
|
||||
*/
|
||||
setNSFW(nsfw = true, reason) {
|
||||
return this.edit({ nsfw }, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Slash to this channel
|
||||
* @param {Snowflake} botId Bot Id
|
||||
@@ -385,6 +443,10 @@ class TextBasedChannel {
|
||||
'awaitMessages',
|
||||
'createMessageComponentCollector',
|
||||
'awaitMessageComponent',
|
||||
'fetchWebhooks',
|
||||
'createWebhook',
|
||||
'setRateLimitPerUser',
|
||||
'setNSFW',
|
||||
);
|
||||
}
|
||||
for (const prop of props) {
|
||||
|
Reference in New Issue
Block a user