From bcc1963cb53c3bc58bcd598310ce7ee37fc96783 Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Sun, 24 Mar 2024 01:47:54 -0500 Subject: [PATCH] convert PossiblyUncached* into interfaces --- lib/gateway/Shard.ts | 2 +- lib/types/channels.d.ts | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/gateway/Shard.ts b/lib/gateway/Shard.ts index 74979f06..38c6fe54 100644 --- a/lib/gateway/Shard.ts +++ b/lib/gateway/Shard.ts @@ -998,7 +998,7 @@ export default class Shard extends TypedEmitter { id: packet.d.id, guild: this.client.guilds.get(packet.d.guild_id), guildID: packet.d.guild_id, - parent: channel, + parent: channel || { id: packet.d.parent_id! }, parentID: packet.d.parent_id!, type: packet.d.type }; diff --git a/lib/types/channels.d.ts b/lib/types/channels.d.ts index 34b9cd31..92661278 100644 --- a/lib/types/channels.d.ts +++ b/lib/types/channels.d.ts @@ -1092,9 +1092,28 @@ export interface ForumEmoji { name: string | null; } -export type PossiblyUncachedMessage = Message | { channel: AnyTextableChannel | Uncached; channelID: string; guild?: Guild; guildID?: string; } & Uncached; -export type PossiblyUncachedThread = AnyThreadChannel | Pick & { guild?: Guild; guildID: string; parent?: ThreadParentChannel; parentID: string; }; -export type MinimalPossiblyUncachedThread = AnyThreadChannel | { guild?: Guild; guildID: string; id: string; }; +export type PossiblyUncachedMessage = Message | UncachedEventMessage; +export type PossiblyUncachedThread = AnyThreadChannel | UncachedEventThread; +export type MinimalPossiblyUncachedThread = AnyThreadChannel | MinimalPossiblyUncachedEventThread; + +export interface UncachedEventMessage extends Uncached { + channel: AnyTextableChannel | Uncached; + channelID: string; + guild?: Guild; + guildID?: string; +} + +export interface UncachedEventThread extends Pick, Uncached { + guild?: Guild; + guildID?: string; + parent?: ThreadParentChannel | Uncached; + parentID: string; +} + +export interface MinimalPossiblyUncachedEventThread extends Uncached { + guild?: Guild; + guildID: string; +} export interface PurgeOptions { /** The ID of the message to purge after. */