diff --git a/packages/discord.js/src/structures/GuildAuditLogs.js b/packages/discord.js/src/structures/GuildAuditLogs.js index 788c03dc1..b5635a378 100644 --- a/packages/discord.js/src/structures/GuildAuditLogs.js +++ b/packages/discord.js/src/structures/GuildAuditLogs.js @@ -7,25 +7,6 @@ const Integration = require('./Integration'); const Webhook = require('./Webhook'); const { flatten } = require('../util/Util'); -/** - * The target type of an entry. Here are the available types: - * * Guild - * * Channel - * * User - * * Role - * * Invite - * * Webhook - * * Emoji - * * Message - * * Integration - * * StageInstance - * * Sticker - * * Thread - * * GuildScheduledEvent - * * ApplicationCommandPermission - * @typedef {string} AuditLogTargetType - */ - /** * Audit logs entries are held in this class. */ diff --git a/packages/discord.js/src/structures/GuildAuditLogsEntry.js b/packages/discord.js/src/structures/GuildAuditLogsEntry.js index 689f79fc7..b0f2fb18a 100644 --- a/packages/discord.js/src/structures/GuildAuditLogsEntry.js +++ b/packages/discord.js/src/structures/GuildAuditLogsEntry.js @@ -61,6 +61,78 @@ const Targets = { * @typedef {string} AuditLogActionType */ +/** + * The target type of an entry. Here are the available types: + * * Guild + * * Channel + * * User + * * Role + * * Invite + * * Webhook + * * Emoji + * * Message + * * Integration + * * StageInstance + * * Sticker + * * Thread + * * GuildScheduledEvent + * * ApplicationCommandPermission + * @typedef {string} AuditLogTargetType + */ + +/** + * The action of an entry. Here are the available actions: + * * GuildUpdate + * * ChannelCreate + * * ChannelUpdate + * * ChannelDelete + * * ChannelOverwriteCreate + * * ChannelOverwriteUpdate + * * ChannelOverwriteDelete + * * MemberKick + * * MemberPrune + * * MemberBanAdd + * * MemberBanRemove + * * MemberUpdate + * * MemberRoleUpdate + * * MemberMove + * * MemberDisconnect + * * BotAdd + * * RoleCreate + * * RoleUpdate + * * RoleDelete + * * InviteCreate + * * InviteUpdate + * * InviteDelete + * * WebhookCreate + * * WebhookUpdate + * * WebhookDelete + * * EmojiCreate + * * EmojiUpdate + * * EmojiDelete + * * MessageDelete + * * MessageBulkDelete + * * MessagePin + * * MessageUnpin + * * IntegrationCreate + * * IntegrationUpdate + * * IntegrationDelete + * * StageInstanceCreate + * * StageInstanceUpdate + * * StageInstanceDelete + * * StickerCreate + * * StickerUpdate + * * StickerDelete + * * GuildScheduledEventCreate + * * GuildScheduledEventUpdate + * * GuildScheduledEventDelete + * * ThreadCreate + * * ThreadUpdate + * * ThreadDelete + * * ApplicationCommandPermissionUpdate + * @typedef {string} AuditLogAction + */ + /** * Audit logs entry. */ @@ -341,7 +413,7 @@ class GuildAuditLogsEntry { /** * Finds the target type of a guild audit log entry. - * @param {AuditLogAction} target The action target. + * @param {AuditLogEvent} target The action target * @returns {AuditLogTargetType} */ static targetType(target) { @@ -364,7 +436,7 @@ class GuildAuditLogsEntry { /** * Finds the action type from the guild audit log entry action. - * @param {AuditLogAction} action The action target. + * @param {AuditLogEvent} action The action target * @returns {AuditLogActionType} */ static actionType(action) { diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 5116ab60d..6f44311f4 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -1192,7 +1192,7 @@ export class GuildAuditLogsEntry< TActionType extends GuildAuditLogsActionType = TAction extends keyof GuildAuditLogsTypes ? GuildAuditLogsTypes[TAction][1] : 'All', - TTargetType extends GuildAuditLogsTarget = TAction extends keyof GuildAuditLogsTypes + TTargetType extends GuildAuditLogsTargetType = TAction extends keyof GuildAuditLogsTypes ? GuildAuditLogsTypes[TAction][0] : 'Unknown', > { @@ -1211,8 +1211,8 @@ export class GuildAuditLogsEntry< ? GuildAuditLogsEntryTargetField[TTargetType] : Role | GuildEmoji | { id: Snowflake } | null; public targetType: TTargetType; - public static actionType(action: number): GuildAuditLogsActionType; - public static targetType(target: number): GuildAuditLogsTarget; + public static actionType(action: AuditLogEvent): GuildAuditLogsActionType; + public static targetType(target: AuditLogEvent): GuildAuditLogsTargetType; public toJSON(): unknown; } @@ -4497,10 +4497,10 @@ export interface GuildAuditLogsFetchOptions export type GuildAuditLogsResolvable = AuditLogEvent | null; -export type GuildAuditLogsTarget = GuildAuditLogsTypes[keyof GuildAuditLogsTypes][0] | 'All' | 'Unknown'; +export type GuildAuditLogsTargetType = GuildAuditLogsTypes[keyof GuildAuditLogsTypes][0] | 'All' | 'Unknown'; export type GuildAuditLogsTargets = { - [key in GuildAuditLogsTarget]: GuildAuditLogsTarget; + [key in GuildAuditLogsTargetType]: GuildAuditLogsTargetType; }; export type GuildBanResolvable = GuildBan | UserResolvable;