aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts1
-rw-r--r--src/lib/extensions/discord.js/BushButtonInteraction.ts8
-rw-r--r--src/lib/extensions/discord.js/BushCommandInteraction.ts8
-rw-r--r--src/lib/extensions/discord.js/BushMessage.ts8
-rw-r--r--src/lib/extensions/discord.js/BushSelectMenuInteraction.ts8
-rw-r--r--yarn.lock11
7 files changed, 20 insertions, 26 deletions
diff --git a/package.json b/package.json
index d764b8c..e67222e 100644
--- a/package.json
+++ b/package.json
@@ -46,6 +46,7 @@
"@types/validator": "^13.6.3",
"@typescript-eslint/eslint-plugin": "^4.32.0",
"@typescript-eslint/parser": "^4.32.0",
+ "discord-api-types": "0.24.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0"
},
@@ -55,7 +56,6 @@
"canvas": "^2.8.0",
"chalk": "^4.1.2",
"discord-akairo": "npm:@notenoughupdates/discord-akairo@dev",
- "discord-api-types": "0.23.1",
"discord.js": "npm:@notenoughupdates/discord.js@dev",
"discord.js-minesweeper": "^1.0.6",
"events-intercept": "^2.0.0",
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);
diff --git a/yarn.lock b/yarn.lock
index eeddda1..3f001fe 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -840,7 +840,7 @@ __metadata:
canvas: ^2.8.0
chalk: ^4.1.2
discord-akairo: "npm:@notenoughupdates/discord-akairo@dev"
- discord-api-types: 0.23.1
+ discord-api-types: 0.24.0
discord.js: "npm:@notenoughupdates/discord.js@dev"
discord.js-minesweeper: ^1.0.6
eslint: ^7.32.0
@@ -1193,14 +1193,7 @@ __metadata:
languageName: node
linkType: hard
-"discord-api-types@npm:0.23.1":
- version: 0.23.1
- resolution: "discord-api-types@npm:0.23.1"
- checksum: e2ea574d51bff9f74770194338ba2b981072c6814a4da4c1e9a6b09b5b6bcf4ecf9044397fd4d2d3bf245f7573f22f1c25ff3f57cfc23ed87dfee4629091c29d
- languageName: node
- linkType: hard
-
-"discord-api-types@npm:^0.24.0":
+"discord-api-types@npm:0.24.0, discord-api-types@npm:^0.24.0":
version: 0.24.0
resolution: "discord-api-types@npm:0.24.0"
checksum: b1a17cb3be4ade974193cedb92fb37e51ba8f1832dfe3ec0d188ba41f255f3dab8359c9d618d32469f1e648126258f9d6ed8828dc1cb50b74d9fd9d875f3390a