Skip to content

Commit

Permalink
convert PossiblyUncached* into interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
DonovanDMC committed Mar 24, 2024
1 parent c382c1d commit bcc1963
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/gateway/Shard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ export default class Shard extends TypedEmitter<ShardEvents> {
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
};
Expand Down
25 changes: 22 additions & 3 deletions lib/types/channels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<AnyThreadChannel, "id" | "type"> & { 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<AnyThreadChannel, "type">, Uncached {
guild?: Guild;
guildID?: string;
parent?: ThreadParentChannel | Uncached;
parentID: string;
}

export interface MinimalPossiblyUncachedEventThread extends Uncached {
guild?: Guild;
guildID: string;
}

export interface PurgeOptions<T extends AnyTextableGuildChannel | Uncached> {
/** The ID of the message to purge after. */
Expand Down

0 comments on commit bcc1963

Please sign in to comment.