blob: 2bf41ba2702f65ecf271850b2b0068418e648b25 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
|