-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
1 parent
7737bbe
commit 84d34dc
Showing
7 changed files
with
64 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
5 changes: 5 additions & 0 deletions
5
src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = (client, packet) => { | ||
client.actions.GuildAuditLogEntryCreate.handle(packet.d); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters