mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
feat: Guild Integrations (#2760)
* feat: Guild Integrations * feat: Guild#createIntegration * feat: Add ws event GUILD_INTEGRATIONS_UPDATE * docs: Add `GUILD_INTEGRATIONS_UPDATE` to WSEventType * misc: Fixed requested change * docs: Updated typings * typings: Sort members by name
This commit is contained in:
@@ -31,6 +31,7 @@ class WebSocketPacketManager {
|
||||
this.register(WSEvents.GUILD_ROLE_UPDATE, require('./handlers/GuildRoleUpdate'));
|
||||
this.register(WSEvents.GUILD_EMOJIS_UPDATE, require('./handlers/GuildEmojisUpdate'));
|
||||
this.register(WSEvents.GUILD_MEMBERS_CHUNK, require('./handlers/GuildMembersChunk'));
|
||||
this.register(WSEvents.GUILD_INTEGRATIONS_UPDATE, require('./handlers/GuildIntegrationsUpdate'));
|
||||
this.register(WSEvents.CHANNEL_CREATE, require('./handlers/ChannelCreate'));
|
||||
this.register(WSEvents.CHANNEL_DELETE, require('./handlers/ChannelDelete'));
|
||||
this.register(WSEvents.CHANNEL_UPDATE, require('./handlers/ChannelUpdate'));
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
const AbstractHandler = require('./AbstractHandler');
|
||||
const { Events } = require('../../../../util/Constants');
|
||||
|
||||
class GuildIntegrationsHandler extends AbstractHandler {
|
||||
handle(packet) {
|
||||
const client = this.packetManager.client;
|
||||
const data = packet.d;
|
||||
const guild = client.guilds.get(data.guild_id);
|
||||
if (guild) client.emit(Events.GUILD_INTEGRATIONS_UPDATE, guild);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = GuildIntegrationsHandler;
|
||||
|
||||
/**
|
||||
* Emitted whenever a guild integration is updated
|
||||
* @event Client#guildIntegrationsUpdate
|
||||
* @param {Guild} guild The guild whose integrations were updated
|
||||
*/
|
||||
Reference in New Issue
Block a user