diff options
Diffstat (limited to 'node_modules/discord.js/src/client/actions/WebhooksUpdate.js')
-rw-r--r-- | node_modules/discord.js/src/client/actions/WebhooksUpdate.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/client/actions/WebhooksUpdate.js b/node_modules/discord.js/src/client/actions/WebhooksUpdate.js new file mode 100644 index 0000000..2bf41ba --- /dev/null +++ b/node_modules/discord.js/src/client/actions/WebhooksUpdate.js @@ -0,0 +1,37 @@ +'use strict'; + +const process = require('node:process'); +const Action = require('./Action'); + +let deprecationEmitted = false; + +class WebhooksUpdate extends Action { + handle(data) { + const client = this.client; + const channel = client.channels.cache.get(data.channel_id); + if (!channel) return; + + // TODO: change to Events.WebhooksUpdate in the next major version + /** + * Emitted whenever a channel has its webhooks changed. + * @event Client#webhooksUpdate + * @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel} channel + * The channel that had a webhook update + */ + client.emit('webhooksUpdate', channel); + + /** + * Emitted whenever a channel has its webhooks changed. + * @event Client#webhookUpdate + * @param {TextChannel|NewsChannel|VoiceChannel|StageChannel|ForumChannel} channel + * The channel that had a webhook update + * @deprecated Use {@link Client#event:webhooksUpdate} instead. + */ + if (client.emit('webhookUpdate', channel) && !deprecationEmitted) { + deprecationEmitted = true; + process.emitWarning('The webhookUpdate event is deprecated. Use webhooksUpdate instead.', 'DeprecationWarning'); + } + } +} + +module.exports = WebhooksUpdate; |