mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 22:11:53 +00:00
backport: WEBHOOKS_UPDATE event (#2779)
This commit is contained in:
parent
93bf430fc7
commit
453098117f
3 changed files with 23 additions and 0 deletions
|
|
@ -53,6 +53,7 @@ class WebSocketPacketManager {
|
|||
this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, require('./handlers/MessageReactionAdd'));
|
||||
this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, require('./handlers/MessageReactionRemove'));
|
||||
this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, require('./handlers/MessageReactionRemoveAll'));
|
||||
this.register(Constants.WSEvents.WEBHOOKS_UPDATE, require('./handlers/WebhooksUpdate'));
|
||||
}
|
||||
|
||||
get client() {
|
||||
|
|
|
|||
19
src/client/websocket/packets/handlers/WebhooksUpdate.js
Normal file
19
src/client/websocket/packets/handlers/WebhooksUpdate.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
const AbstractHandler = require('./AbstractHandler');
|
||||
const { Events } = require('../../../../util/Constants');
|
||||
|
||||
class WebhooksUpdate extends AbstractHandler {
|
||||
handle(packet) {
|
||||
const client = this.packetManager.client;
|
||||
const data = packet.d;
|
||||
const channel = client.channels.get(data.channel_id);
|
||||
if (channel) client.emit(Events.WEBHOOKS_UPDATE, channel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Emitted whenever a guild text channel has its webhooks changed.
|
||||
* @event Client#webhookUpdate
|
||||
* @param {TextChannel} channel The channel that had a webhook update
|
||||
*/
|
||||
|
||||
module.exports = WebhooksUpdate;
|
||||
|
|
@ -346,6 +346,7 @@ exports.Events = {
|
|||
VOICE_STATE_UPDATE: 'voiceStateUpdate',
|
||||
TYPING_START: 'typingStart',
|
||||
TYPING_STOP: 'typingStop',
|
||||
WEBHOOKS_UPDATE: 'webhookUpdate',
|
||||
DISCONNECT: 'disconnect',
|
||||
RECONNECTING: 'reconnecting',
|
||||
ERROR: 'error',
|
||||
|
|
@ -414,6 +415,7 @@ exports.ActivityFlags = {
|
|||
* * VOICE_SERVER_UPDATE
|
||||
* * RELATIONSHIP_ADD
|
||||
* * RELATIONSHIP_REMOVE
|
||||
* * WEBHOOKS_UPDATE
|
||||
* @typedef {string} WSEventType
|
||||
*/
|
||||
exports.WSEvents = {
|
||||
|
|
@ -454,6 +456,7 @@ exports.WSEvents = {
|
|||
VOICE_SERVER_UPDATE: 'VOICE_SERVER_UPDATE',
|
||||
RELATIONSHIP_ADD: 'RELATIONSHIP_ADD',
|
||||
RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE',
|
||||
WEBHOOKS_UPDATE: 'WEBHOOKS_UPDATE',
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue