-
-
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(Client):
guildAuditLogEntryCreate
event (#9058)
* feat(Client): `guildAuditLogEntryCreate` event * feat: add `targetId` and `executorId` * types: `ApplicationCommand` fix --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1ba1f23
commit 9439107
Showing
11 changed files
with
71 additions
and
12 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
29 changes: 29 additions & 0 deletions
29
packages/discord.js/src/client/actions/GuildAuditLogEntryCreate.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,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; |
5 changes: 5 additions & 0 deletions
5
packages/discord.js/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
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
9439107
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
discord-js – ./apps/website
discord-js-number-one.vercel.app
discord-js-discordjs.vercel.app
www.discordjs.dev
discord-js-git-main-discordjs.vercel.app
discordjs.dev
9439107
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
discord-js-guide – ./apps/guide
discord-js-guide.vercel.app
next.discordjs.guide
discord-js-guide-discordjs.vercel.app
discord-js-guide-git-main-discordjs.vercel.app
guide.discordjs.dev