diff options
Diffstat (limited to 'src')
5 files changed, 17 insertions, 16 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 4954d8e..c5d05b7 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -97,6 +97,7 @@ export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflak export type BushGuildTextChannelResolvable = BushTextChannel | BushNewsChannel | Snowflake; export type BushChannelResolvable = BushChannel | Snowflake; export type BushTextBasedChannels = PartialDMChannel | BushDMChannel | BushTextChannel | BushNewsChannel | BushThreadChannel; +export type BushGuildTextBasedChannel = Exclude<BushTextBasedChannels, PartialDMChannel | BushDMChannel>; export interface BushFetchedThreads { threads: Collection<Snowflake, BushThreadChannel>; hasMore?: boolean; diff --git a/src/lib/extensions/discord.js/BushButtonInteraction.ts b/src/lib/extensions/discord.js/BushButtonInteraction.ts index 413522f..26b98f6 100644 --- a/src/lib/extensions/discord.js/BushButtonInteraction.ts +++ b/src/lib/extensions/discord.js/BushButtonInteraction.ts @@ -1,15 +1,15 @@ import { APIInteractionGuildMember } from 'discord-api-types/v9'; -import { ButtonInteraction } from 'discord.js'; +import { ButtonInteraction, CacheType, CacheTypeReducer } from 'discord.js'; import { RawMessageButtonInteractionData } from 'discord.js/typings/rawDataTypes'; import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; import { BushGuild } from './BushGuild'; import { BushGuildMember } from './BushGuildMember'; import { BushUser } from './BushUser'; -export class BushButtonInteraction extends ButtonInteraction { +export class BushButtonInteraction<Cached extends CacheType = CacheType> extends ButtonInteraction<Cached> { public declare readonly channel: BushTextBasedChannels | null; - public declare readonly guild: BushGuild | null; - public declare member: BushGuildMember | APIInteractionGuildMember | null; + public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; + public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; public constructor(client: BushClient, data: RawMessageButtonInteractionData) { super(client, data); diff --git a/src/lib/extensions/discord.js/BushCommandInteraction.ts b/src/lib/extensions/discord.js/BushCommandInteraction.ts index b307bbc..eff3b45 100644 --- a/src/lib/extensions/discord.js/BushCommandInteraction.ts +++ b/src/lib/extensions/discord.js/BushCommandInteraction.ts @@ -1,5 +1,5 @@ import { APIInteractionGuildMember } from 'discord-api-types/v9'; -import { CommandInteraction, Invite, Snowflake } from 'discord.js'; +import { CacheType, CacheTypeReducer, CommandInteraction, Invite, Snowflake } from 'discord.js'; import { RawCommandInteractionData } from 'discord.js/typings/rawDataTypes'; import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; import { BushApplicationCommand } from './BushApplicationCommand'; @@ -12,14 +12,14 @@ import { BushUser } from './BushUser'; export type BushGuildResolvable = BushGuild | BushGuildChannel | BushGuildMember | BushGuildEmoji | Invite | BushRole | Snowflake; -export class BushCommandInteraction extends CommandInteraction { +export class BushCommandInteraction<Cached extends CacheType = CacheType> extends CommandInteraction<Cached> { public constructor(client: BushClient, data: RawCommandInteractionData) { super(client, data); } public declare readonly client: BushClient; public declare readonly command: BushApplicationCommand | BushApplicationCommand<{ guild: BushGuildResolvable }> | null; public declare readonly channel: BushTextBasedChannels | null; - public declare readonly guild: BushGuild | null; - public declare member: BushGuildMember | APIInteractionGuildMember | null; + public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; + public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; } diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index 4481910..941df29 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -1,6 +1,6 @@ -import { Message, Partialize } from 'discord.js'; +import { If, Message, Partialize } from 'discord.js'; import { RawMessageData } from 'discord.js/typings/rawDataTypes'; -import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; +import { BushClient, BushGuildTextBasedChannel, BushTextBasedChannels } from '../discord-akairo/BushClient'; import { BushCommandUtil } from '../discord-akairo/BushCommandUtil'; import { BushGuild } from './BushGuild'; import { BushGuildMember } from './BushGuildMember'; @@ -11,13 +11,13 @@ export type PartialBushMessage = Partialize< 'type' | 'system' | 'pinned' | 'tts', 'content' | 'cleanContent' | 'author' >; -export class BushMessage extends Message { +export class BushMessage<Cached extends boolean = boolean> extends Message<Cached> { public declare readonly client: BushClient; public override util!: BushCommandUtil<BushMessage>; public declare readonly guild: BushGuild | null; public declare readonly member: BushGuildMember | null; public declare author: BushUser; - public declare readonly channel: BushTextBasedChannels; + public declare readonly channel: If<Cached, BushGuildTextBasedChannel, BushTextBasedChannels>; public constructor(client: BushClient, data: RawMessageData) { super(client, data); // this.util = new BushCommandUtil(client.commandHandler, this); diff --git a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts index a16d8c2..d4ebd4f 100644 --- a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts +++ b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts @@ -1,15 +1,15 @@ import { APIInteractionGuildMember } from 'discord-api-types/v9'; -import { SelectMenuInteraction } from 'discord.js'; +import { CacheType, CacheTypeReducer, SelectMenuInteraction } from 'discord.js'; import { RawMessageSelectMenuInteractionData } from 'discord.js/typings/rawDataTypes'; import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; import { BushGuild } from './BushGuild'; import { BushGuildMember } from './BushGuildMember'; import { BushUser } from './BushUser'; -export class BushSelectMenuInteraction extends SelectMenuInteraction { +export class BushSelectMenuInteraction<Cached extends CacheType = CacheType> extends SelectMenuInteraction<Cached> { public declare readonly channel: BushTextBasedChannels | null; - public declare readonly guild: BushGuild | null; - public declare member: BushGuildMember | APIInteractionGuildMember | null; + public declare readonly guild: CacheTypeReducer<Cached, BushGuild, null>; + public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>; public declare user: BushUser; public constructor(client: BushClient, data: RawMessageSelectMenuInteractionData) { super(client, data); |