diff options
Diffstat (limited to 'node_modules/discord.js/src/client/actions/GuildAuditLogEntryCreate.js')
-rw-r--r-- | node_modules/discord.js/src/client/actions/GuildAuditLogEntryCreate.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/client/actions/GuildAuditLogEntryCreate.js b/node_modules/discord.js/src/client/actions/GuildAuditLogEntryCreate.js new file mode 100644 index 0000000..fa16de6 --- /dev/null +++ b/node_modules/discord.js/src/client/actions/GuildAuditLogEntryCreate.js @@ -0,0 +1,29 @@ +'use strict'; + +const Action = require('./Action'); +const GuildAuditLogsEntry = require('../../structures/GuildAuditLogsEntry'); +const Events = require('../../util/Events'); + +class GuildAuditLogEntryCreateAction extends Action { + handle(data) { + const client = this.client; + const guild = client.guilds.cache.get(data.guild_id); + let auditLogEntry; + + if (guild) { + auditLogEntry = new GuildAuditLogsEntry(guild, data); + + /** + * Emitted whenever a guild audit log entry is created. + * @event Client#guildAuditLogEntryCreate + * @param {GuildAuditLogsEntry} auditLogEntry The entry that was created + * @param {Guild} guild The guild where the entry was created + */ + client.emit(Events.GuildAuditLogEntryCreate, auditLogEntry, guild); + } + + return { auditLogEntry }; + } +} + +module.exports = GuildAuditLogEntryCreateAction; |