mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 17:43:30 +01:00
docs(GuildAuditLogs): Fix and reimplement type definitions (#8108)
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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) {
|
||||
|
||||
10
packages/discord.js/typings/index.d.ts
vendored
10
packages/discord.js/typings/index.d.ts
vendored
@@ -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<TActionType>[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<T extends GuildAuditLogsResolvable>
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user