mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 21:43:33 +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 Webhook = require('./Webhook');
|
||||||
const { flatten } = require('../util/Util');
|
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.
|
* Audit logs entries are held in this class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -61,6 +61,78 @@ const Targets = {
|
|||||||
* @typedef {string} AuditLogActionType
|
* @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.
|
* Audit logs entry.
|
||||||
*/
|
*/
|
||||||
@@ -341,7 +413,7 @@ class GuildAuditLogsEntry {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the target type of a guild audit log entry.
|
* Finds the target type of a guild audit log entry.
|
||||||
* @param {AuditLogAction} target The action target.
|
* @param {AuditLogEvent} target The action target
|
||||||
* @returns {AuditLogTargetType}
|
* @returns {AuditLogTargetType}
|
||||||
*/
|
*/
|
||||||
static targetType(target) {
|
static targetType(target) {
|
||||||
@@ -364,7 +436,7 @@ class GuildAuditLogsEntry {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the action type from the guild audit log entry action.
|
* 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}
|
* @returns {AuditLogActionType}
|
||||||
*/
|
*/
|
||||||
static actionType(action) {
|
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
|
TActionType extends GuildAuditLogsActionType = TAction extends keyof GuildAuditLogsTypes
|
||||||
? GuildAuditLogsTypes[TAction][1]
|
? GuildAuditLogsTypes[TAction][1]
|
||||||
: 'All',
|
: 'All',
|
||||||
TTargetType extends GuildAuditLogsTarget = TAction extends keyof GuildAuditLogsTypes
|
TTargetType extends GuildAuditLogsTargetType = TAction extends keyof GuildAuditLogsTypes
|
||||||
? GuildAuditLogsTypes[TAction][0]
|
? GuildAuditLogsTypes[TAction][0]
|
||||||
: 'Unknown',
|
: 'Unknown',
|
||||||
> {
|
> {
|
||||||
@@ -1211,8 +1211,8 @@ export class GuildAuditLogsEntry<
|
|||||||
? GuildAuditLogsEntryTargetField<TActionType>[TTargetType]
|
? GuildAuditLogsEntryTargetField<TActionType>[TTargetType]
|
||||||
: Role | GuildEmoji | { id: Snowflake } | null;
|
: Role | GuildEmoji | { id: Snowflake } | null;
|
||||||
public targetType: TTargetType;
|
public targetType: TTargetType;
|
||||||
public static actionType(action: number): GuildAuditLogsActionType;
|
public static actionType(action: AuditLogEvent): GuildAuditLogsActionType;
|
||||||
public static targetType(target: number): GuildAuditLogsTarget;
|
public static targetType(target: AuditLogEvent): GuildAuditLogsTargetType;
|
||||||
public toJSON(): unknown;
|
public toJSON(): unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4497,10 +4497,10 @@ export interface GuildAuditLogsFetchOptions<T extends GuildAuditLogsResolvable>
|
|||||||
|
|
||||||
export type GuildAuditLogsResolvable = AuditLogEvent | null;
|
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 = {
|
export type GuildAuditLogsTargets = {
|
||||||
[key in GuildAuditLogsTarget]: GuildAuditLogsTarget;
|
[key in GuildAuditLogsTargetType]: GuildAuditLogsTargetType;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GuildBanResolvable = GuildBan | UserResolvable;
|
export type GuildBanResolvable = GuildBan | UserResolvable;
|
||||||
|
|||||||
Reference in New Issue
Block a user