feat: v13 guildAuditLogEntryCreate event (#9092)

* feat: guildAuditLogEntryCreate event

* Update src/client/actions/GuildAuditLogEntryCreate.js

Co-authored-by: Elysia <71698422+aiko-chan-ai@users.noreply.github.com>

* Update src/client/actions/GuildAuditLogEntryCreate.js

Co-authored-by: space <spaceeec@yahoo.com>

---------

Co-authored-by: Elysia <71698422+aiko-chan-ai@users.noreply.github.com>
Co-authored-by: space <spaceeec@yahoo.com>
This commit is contained in:
Jaworek
2023-02-18 00:07:30 +01:00
committed by GitHub
parent 7737bbe2fe
commit 84d34dc258
7 changed files with 64 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ class ActionsManager {
this.register(require('./ChannelCreate'));
this.register(require('./ChannelDelete'));
this.register(require('./ChannelUpdate'));
this.register(require('./GuildAuditLogEntryCreate'));
this.register(require('./GuildBanAdd'));
this.register(require('./GuildBanRemove'));
this.register(require('./GuildChannelsPositionUpdate'));

View File

@@ -0,0 +1,29 @@
'use strict';
const Action = require('./Action');
const GuildAuditLogsEntry = require('../../structures/GuildAuditLogs').Entry;
const { Events } = require('../../util/Constants');
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.GUILD_AUDIT_LOG_ENTRY_CREATE, auditLogEntry, guild);
}
return { auditLogEntry };
}
}
module.exports = GuildAuditLogEntryCreateAction;