From dc6c02cb2d26cbaee2952088c27326c0230180bd Mon Sep 17 00:00:00 2001 From: ITOH Date: Thu, 27 May 2021 15:16:24 +0200 Subject: [PATCH 1/2] idk --- src/types/audit_log/audit_log_change.ts | 84 +++++++++++++++++-- src/types/audit_log/audit_log_change_value.ts | 77 ----------------- 2 files changed, 75 insertions(+), 86 deletions(-) delete mode 100644 src/types/audit_log/audit_log_change_value.ts diff --git a/src/types/audit_log/audit_log_change.ts b/src/types/audit_log/audit_log_change.ts index 7ded886b4..e49ee172c 100644 --- a/src/types/audit_log/audit_log_change.ts +++ b/src/types/audit_log/audit_log_change.ts @@ -1,11 +1,77 @@ -import { AuditLogChangeValue } from "./audit_log_change_value.ts"; +import { Overwrite } from "../channels/overwrite.ts"; +import { Role } from "../permissions/role.ts"; /** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */ -export interface AuditLogChange { - /** New value of the key */ - newValue?: AuditLogChangeValue; - /** Old value of the key */ - oldValue?: AuditLogChangeValue; - /** Name of audit log change key */ - key: string; -} +export type AuditLogChange = + | { + newValue: string; + oldValue: string; + key: + | "name" + | "description" + | "discovery_splash_hash" + | "banner_hash" + | "preferred_locale" + | "rules_channel_id" + | "public_updates_channel_id" + | "icon_hash" + | "splash_hash" + | "owner_id" + | "region" + | "afk_channel_id" + | "vanity_url_code" + | "widget_channel_id" + | "system_channel_id" + | "topic" + | "application_id" + | "permissions" + | "allow" + | "deny" + | "code" + | "channel_id" + | "inviter_id" + | "nick" + | "avatar_hash" + | "id"; + } + | { + newValue: number; + oldValue: number; + key: + | "afk_timeout" + | "mfa_level" + | "verification_level" + | "explicit_content_filter" + | "default_messagae_notifications" + | "prune_delete_days" + | "position" + | "bitrate" + | "rate_limit_per_user" + | "color" + | "max_uses" + | "uses" + | "max_age" + | "expire_behavior" + | "expire_grace_period" + | "user_limit"; + } + | { + newValue: Partial; + oldValue: Partial; + key: "$add" | "$remove"; + } + | { + newValue: boolean; + oldValue: boolean; + key: "widget_enabled" | "nsfw" | "hoist" | "mentionable" | "temporary" | "deaf" | "mute" | "enable_emoticons"; + } + | { + newValue: Overwrite[]; + oldValue: Overwrite[]; + key: "permission_overwrites"; + } + | { + newValue: string | number; + oldValue: string | number; + key: "type"; + }; diff --git a/src/types/audit_log/audit_log_change_value.ts b/src/types/audit_log/audit_log_change_value.ts deleted file mode 100644 index 7919d5c97..000000000 --- a/src/types/audit_log/audit_log_change_value.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { Overwrite } from "../channels/overwrite.ts"; -import { Role } from "../permissions/role.ts"; - -/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */ -export type AuditLogChangeValue = - | { - newValue: string; - oldValue: string; - key: - | "name" - | "description" - | "discovery_splash_hash" - | "banner_hash" - | "preferred_locale" - | "rules_channel_id" - | "public_updates_channel_id" - | "icon_hash" - | "splash_hash" - | "owner_id" - | "region" - | "afk_channel_id" - | "vanity_url_code" - | "widget_channel_id" - | "system_channel_id" - | "topic" - | "application_id" - | "permissions" - | "allow" - | "deny" - | "code" - | "channel_id" - | "inviter_id" - | "nick" - | "avatar_hash" - | "id"; - } - | { - newValue: number; - oldValue: number; - key: - | "afk_timeout" - | "mfa_level" - | "verification_level" - | "explicit_content_filter" - | "default_messagae_notifications" - | "prune_delete_days" - | "position" - | "bitrate" - | "rate_limit_per_user" - | "color" - | "max_uses" - | "uses" - | "max_age" - | "expire_behavior" - | "expire_grace_period" - | "user_limit"; - } - | { - newValue: Partial; - oldValue: Partial; - key: "$add" | "$remove"; - } - | { - newValue: boolean; - oldValue: boolean; - key: "widget_enabled" | "nsfw" | "hoist" | "mentionable" | "temporary" | "deaf" | "mute" | "enable_emoticons"; - } - | { - newValue: Overwrite[]; - oldValue: Overwrite[]; - key: "permission_overwrites"; - } - | { - newValue: string | number; - oldValue: string | number; - key: "type"; - }; From c9fd6f7cbf76fdf0dd31ba3fc50bebb3cb2b4128 Mon Sep 17 00:00:00 2001 From: ITOH Date: Thu, 27 May 2021 16:11:38 +0200 Subject: [PATCH 2/2] Update mod.ts --- src/types/audit_log/mod.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types/audit_log/mod.ts b/src/types/audit_log/mod.ts index fda2a03d5..dace5da18 100644 --- a/src/types/audit_log/mod.ts +++ b/src/types/audit_log/mod.ts @@ -1,6 +1,5 @@ export * from "./audit_log.ts"; export * from "./audit_log_change.ts"; -export * from "./audit_log_change_value.ts"; export * from "./audit_log_entry.ts"; export * from "./audit_log_events.ts"; export * from "./get_guild_audit_log.ts";