aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts57
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts2
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandUtil.ts14
-rw-r--r--src/lib/extensions/discord.js/BushActivity.ts10
-rw-r--r--src/lib/extensions/discord.js/BushApplicationCommand.ts14
-rw-r--r--src/lib/extensions/discord.js/BushApplicationCommandManager.ts24
-rw-r--r--src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts24
-rw-r--r--src/lib/extensions/discord.js/BushButtonInteraction.ts19
-rw-r--r--src/lib/extensions/discord.js/BushCategoryChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushCommandInteraction.ts37
-rw-r--r--src/lib/extensions/discord.js/BushDMChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushEmoji.ts9
-rw-r--r--src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts10
-rw-r--r--src/lib/extensions/discord.js/BushGuildChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushGuildEmoji.ts2
-rw-r--r--src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts2
-rw-r--r--src/lib/extensions/discord.js/BushMessage.ts4
-rw-r--r--src/lib/extensions/discord.js/BushMessageManager.ts2
-rw-r--r--src/lib/extensions/discord.js/BushMessageReaction.ts14
-rw-r--r--src/lib/extensions/discord.js/BushNewsChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushPresence.ts15
-rw-r--r--src/lib/extensions/discord.js/BushReactionEmoji.ts11
-rw-r--r--src/lib/extensions/discord.js/BushRole.ts2
-rw-r--r--src/lib/extensions/discord.js/BushSelectMenuInteraction.ts19
-rw-r--r--src/lib/extensions/discord.js/BushStageChannel.ts17
-rw-r--r--src/lib/extensions/discord.js/BushStageInstance.ts13
-rw-r--r--src/lib/extensions/discord.js/BushStoreChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushTextChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushThreadChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushThreadManager.ts2
-rw-r--r--src/lib/extensions/discord.js/BushThreadMember.ts2
-rw-r--r--src/lib/extensions/discord.js/BushThreadMemberManager.ts2
-rw-r--r--src/lib/extensions/discord.js/BushVoiceChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushVoiceState.ts14
-rw-r--r--src/lib/utils/BushLogger.ts55
-rw-r--r--src/lib/utils/CanvasProgressBar.ts2
37 files changed, 367 insertions, 49 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index c18fe80..724f01a 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -24,10 +24,26 @@ import AllowedMentions from '../../utils/AllowedMentions';
import { BushCache } from '../../utils/BushCache';
import { BushConstants } from '../../utils/BushConstants';
import { BushLogger } from '../../utils/BushLogger';
+import { BushButtonInteraction } from '../discord.js/BushButtonInteraction';
+import { BushCategoryChannel } from '../discord.js/BushCategoryChannel';
+import { BushCommandInteraction } from '../discord.js/BushCommandInteraction';
+import { BushDMChannel } from '../discord.js/BushDMChannel';
import { BushGuild } from '../discord.js/BushGuild';
+import { BushGuildEmoji } from '../discord.js/BushGuildEmoji';
import { BushGuildMember } from '../discord.js/BushGuildMember';
import { BushMessage } from '../discord.js/BushMessage';
+import { BushMessageReaction } from '../discord.js/BushMessageReaction';
+import { BushNewsChannel } from '../discord.js/BushNewsChannel';
+import { BushPresence } from '../discord.js/BushPresence';
+import { BushRole } from '../discord.js/BushRole';
+import { BushSelectMenuInteraction } from '../discord.js/BushSelectMenuInteraction';
+import { BushStoreChannel } from '../discord.js/BushStoreChannel';
+import { BushTextChannel } from '../discord.js/BushTextChannel';
+import { BushThreadChannel } from '../discord.js/BushThreadChannel';
+import { BushThreadMember } from '../discord.js/BushThreadMember';
import { BushUser } from '../discord.js/BushUser';
+import { BushVoiceChannel } from '../discord.js/BushVoiceChannel';
+import { BushVoiceState } from '../discord.js/BushVoiceState';
import { BushClientUtil } from './BushClientUtil';
import { BushCommandHandler } from './BushCommandHandler';
import { BushInhibitorHandler } from './BushInhinitorHandler';
@@ -46,6 +62,29 @@ const rl = readline.createInterface({
});
export class BushClient extends AkairoClient {
+ public static preStart(): void {
+ Structures.extend('GuildEmoji', () => BushGuildEmoji);
+ Structures.extend('DMChannel', () => BushDMChannel);
+ Structures.extend('TextChannel', () => BushTextChannel);
+ Structures.extend('VoiceChannel', () => BushVoiceChannel);
+ Structures.extend('CategoryChannel', () => BushCategoryChannel);
+ Structures.extend('NewsChannel', () => BushNewsChannel);
+ Structures.extend('StoreChannel', () => BushStoreChannel);
+ Structures.extend('ThreadChannel', () => BushThreadChannel);
+ Structures.extend('GuildMember', () => BushGuildMember);
+ Structures.extend('ThreadMember', () => BushThreadMember);
+ Structures.extend('Guild', () => BushGuild);
+ Structures.extend('Message', () => BushMessage);
+ Structures.extend('MessageReaction', () => BushMessageReaction);
+ Structures.extend('Presence', () => BushPresence);
+ Structures.extend('VoiceState', () => BushVoiceState);
+ Structures.extend('Role', () => BushRole);
+ Structures.extend('User', () => BushUser);
+ Structures.extend('CommandInteraction', () => BushCommandInteraction);
+ Structures.extend('ButtonInteraction', () => BushButtonInteraction);
+ Structures.extend('SelectMenuInteraction', () => BushSelectMenuInteraction);
+ }
+
public config: BotConfig;
public listenerHandler: BushListenerHandler;
public inhibitorHandler: BushInhibitorHandler;
@@ -57,7 +96,7 @@ export class BushClient extends AkairoClient {
public logger: BushLogger;
public constants = BushConstants;
public cache = BushCache;
- constructor(config: BotConfig) {
+ public constructor(config: BotConfig) {
super(
{
ownerID: config.owners,
@@ -77,24 +116,24 @@ export class BushClient extends AkairoClient {
// Create listener handler
this.listenerHandler = new BushListenerHandler(this, {
- directory: path.join(__dirname, '..', '..', 'listeners'),
+ directory: path.join(__dirname, '..', '..', '..', 'listeners'),
automateCategories: true
});
// Create inhibitor handler
this.inhibitorHandler = new BushInhibitorHandler(this, {
- directory: path.join(__dirname, '..', '..', 'inhibitors'),
+ directory: path.join(__dirname, '..', '..', '..', 'inhibitors'),
automateCategories: true
});
// Create task handler
this.taskHandler = new BushTaskHandler(this, {
- directory: path.join(__dirname, '..', '..', 'tasks')
+ directory: path.join(__dirname, '..', '..', '..', 'tasks')
});
// Create command handler
this.commandHandler = new BushCommandHandler(this, {
- directory: path.join(__dirname, '..', '..', 'commands'),
+ directory: path.join(__dirname, '..', '..', '..', 'commands'),
prefix: async ({ guild }: { guild: Guild }) => {
if (this.config.dev) return 'dev ';
const row = await Models.Guild.findByPk(guild.id);
@@ -144,11 +183,6 @@ export class BushClient extends AkairoClient {
// Initialize everything
private async _init(): Promise<void> {
- Structures.extend('User', () => BushUser);
- Structures.extend('Guild', () => BushGuild);
- Structures.extend('GuildMember', () => BushGuildMember);
- Structures.extend('Message', () => BushMessage);
-
this.commandHandler.useListenerHandler(this.listenerHandler);
this.commandHandler.useInhibitorHandler(this.inhibitorHandler);
this.commandHandler.ignorePermissions = this.config.owners;
@@ -206,6 +240,9 @@ export class BushClient extends AkairoClient {
/** Starts the bot */
public async start(): Promise<void> {
+ //@ts-ignore: stfu bitch
+ global.client = this;
+
try {
await this._init();
await this.login(this.token);
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 94ad10c..1f8c0f9 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -105,7 +105,7 @@ export class BushClientUtil extends ClientUtil {
* Creates this client util
* @param client The client to initialize with
*/
- constructor(client: BushClient) {
+ public constructor(client: BushClient) {
super(client);
}
diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts
index b7071b5..101c9d3 100644
--- a/src/lib/extensions/discord-akairo/BushCommand.ts
+++ b/src/lib/extensions/discord-akairo/BushCommand.ts
@@ -42,7 +42,7 @@ export class BushCommand extends Command {
/** Whether the command is hidden from the help command. */
public hidden: boolean;
- constructor(id: string, options?: BushCommandOptions) {
+ public constructor(id: string, options?: BushCommandOptions) {
super(id, options);
this.options = options;
this.hidden = options.hidden || false;
diff --git a/src/lib/extensions/discord-akairo/BushCommandUtil.ts b/src/lib/extensions/discord-akairo/BushCommandUtil.ts
index b4084bd..a1c8036 100644
--- a/src/lib/extensions/discord-akairo/BushCommandUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushCommandUtil.ts
@@ -1,10 +1,22 @@
import { CommandUtil, ParsedComponentData } from 'discord-akairo';
+import { Collection, Snowflake } from 'discord.js';
+import { BushMessage } from '../discord.js/BushMessage';
import { BushCommand } from './BushCommand';
+import { BushCommandHandler } from './BushCommandHandler';
export interface BushParsedComponentData extends ParsedComponentData {
command?: BushCommand;
}
export class BushCommandUtil extends CommandUtil {
- declare parsed?: BushParsedComponentData;
+ public declare parsed?: BushParsedComponentData;
+ public declare handler: BushCommandHandler;
+ public declare message: BushMessage;
+ public declare messages?: Collection<Snowflake, BushMessage>;
+ public test: string;
+
+ public constructor(handler: BushCommandHandler, message: BushMessage) {
+ super(handler, message);
+ this.test = 'abc';
+ }
}
diff --git a/src/lib/extensions/discord.js/BushActivity.ts b/src/lib/extensions/discord.js/BushActivity.ts
new file mode 100644
index 0000000..6ca1611
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushActivity.ts
@@ -0,0 +1,10 @@
+import { Activity } from 'discord.js';
+import { BushEmoji } from './BushEmoji';
+import { BushPresence } from './BushPresence';
+
+export class BushActivity extends Activity {
+ public emoji: BushEmoji | null;
+ public constructor(presence: BushPresence, data?: unknown) {
+ super(presence, data);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushApplicationCommand.ts b/src/lib/extensions/discord.js/BushApplicationCommand.ts
new file mode 100644
index 0000000..5a0e139
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushApplicationCommand.ts
@@ -0,0 +1,14 @@
+/* eslint-disable @typescript-eslint/ban-types */
+/* eslint-disable @typescript-eslint/no-unused-vars */
+import { ApplicationCommand, Snowflake } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushGuild } from './BushGuild';
+
+export class BushApplicationCommand<PermissionsFetchType = {}> extends ApplicationCommand {
+ public declare readonly client: BushClient;
+ public guild: BushGuild | null;
+
+ public constructor(client: BushClient, data: unknown, guild?: BushGuild, guildID?: Snowflake) {
+ super(client, data, guild, guildID);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushApplicationCommandManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts
new file mode 100644
index 0000000..fb3375a
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts
@@ -0,0 +1,24 @@
+/* eslint-disable @typescript-eslint/no-explicit-any */
+import { ApplicationCommandManager, ApplicationCommandPermissionsManager, GuildResolvable, Snowflake } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushApplicationCommand } from './BushApplicationCommand';
+import { BushGuildResolvable } from './BushCommandInteraction';
+
+export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflake;
+
+export class BushApplicationCommandManager<
+ ApplicationCommandType = BushApplicationCommand<{ guild: BushGuildResolvable }>,
+ PermissionsOptionsExtras = { guild: GuildResolvable },
+ PermissionsGuildType = null
+> extends ApplicationCommandManager<ApplicationCommandType, PermissionsOptionsExtras, PermissionsGuildType> {
+ public permissions: ApplicationCommandPermissionsManager<
+ { command?: BushApplicationCommandResolvable } & PermissionsOptionsExtras,
+ { command: BushApplicationCommandResolvable } & PermissionsOptionsExtras,
+ PermissionsGuildType,
+ null
+ >;
+
+ public constructor(client: BushClient, iterable?: Iterable<any>) {
+ super(client, iterable);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts
new file mode 100644
index 0000000..517935d
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts
@@ -0,0 +1,24 @@
+import {
+ ApplicationCommand,
+ ApplicationCommandManager,
+ ApplicationCommandPermissionsManager,
+ GuildApplicationCommandManager
+} from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushApplicationCommand } from './BushApplicationCommand';
+import { BushApplicationCommandManager } from './BushApplicationCommandManager';
+import { BushGuildApplicationCommandManager } from './BushGuildApplicationCommandManager';
+
+export class BushApplicationCommandPermissionsManager<
+ BaseOptions,
+ FetchSingleOptions,
+ GuildType,
+ CommandIDType
+> extends ApplicationCommandPermissionsManager<BaseOptions, FetchSingleOptions, GuildType, CommandIDType> {
+ public client: BushClient;
+ public manager: BushApplicationCommandManager | BushGuildApplicationCommandManager | BushApplicationCommand;
+
+ public constructor(manager: ApplicationCommandManager | GuildApplicationCommandManager | ApplicationCommand) {
+ super(manager);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushButtonInteraction.ts b/src/lib/extensions/discord.js/BushButtonInteraction.ts
new file mode 100644
index 0000000..3a54f61
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushButtonInteraction.ts
@@ -0,0 +1,19 @@
+import { APIInteractionGuildMember } from 'discord-api-types/v8';
+import { ButtonInteraction, PartialDMChannel } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushDMChannel } from './BushDMChannel';
+import { BushGuild } from './BushGuild';
+import { BushGuildMember } from './BushGuildMember';
+import { BushNewsChannel } from './BushNewsChannel';
+import { BushTextChannel } from './BushTextChannel';
+import { BushUser } from './BushUser';
+
+export class BushButtonInteraction extends ButtonInteraction {
+ public declare readonly channel: BushTextChannel | BushDMChannel | BushNewsChannel | PartialDMChannel | null;
+ public declare readonly guild: BushGuild | null;
+ public declare member: BushGuildMember | APIInteractionGuildMember | null;
+ public declare user: BushUser;
+ public constructor(client: BushClient, data: unknown) {
+ super(client, data);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushCategoryChannel.ts b/src/lib/extensions/discord.js/BushCategoryChannel.ts
index c4bc3ca..a66b2c6 100644
--- a/src/lib/extensions/discord.js/BushCategoryChannel.ts
+++ b/src/lib/extensions/discord.js/BushCategoryChannel.ts
@@ -10,7 +10,7 @@ export class BushCategoryChannel extends CategoryChannel {
public declare guild: BushGuild;
public declare readonly members: Collection<Snowflake, BushGuildMember>;
public declare readonly parent: CategoryChannel | null;
- constructor(guild: BushGuild, data?: unknown) {
+ public constructor(guild: BushGuild, data?: unknown) {
super(guild, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushCommandInteraction.ts b/src/lib/extensions/discord.js/BushCommandInteraction.ts
new file mode 100644
index 0000000..84c0707
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushCommandInteraction.ts
@@ -0,0 +1,37 @@
+import { APIInteractionGuildMember } from 'discord-api-types/v8';
+import {
+ ApplicationCommand,
+ CommandInteraction,
+ DMChannel,
+ Invite,
+ NewsChannel,
+ PartialDMChannel,
+ Snowflake,
+ TextChannel
+} from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushApplicationCommand } from './BushApplicationCommand';
+import { BushGuild } from './BushGuild';
+import { BushGuildChannel } from './BushGuildChannel';
+import { BushGuildEmoji } from './BushGuildEmoji';
+import { BushGuildMember } from './BushGuildMember';
+import { BushRole } from './BushRole';
+import { BushUser } from './BushUser';
+
+export type BushGuildResolvable =
+ | BushGuild
+ | BushGuildChannel
+ | BushGuildMember
+ | BushGuildEmoji
+ | Invite
+ | BushRole
+ | Snowflake;
+
+export class BushCommandInteraction extends CommandInteraction {
+ public declare readonly client: BushClient;
+ public declare readonly command: BushApplicationCommand | ApplicationCommand<{ guild: BushGuildResolvable }> | null;
+ public declare readonly channel: TextChannel | DMChannel | NewsChannel | PartialDMChannel | null;
+ public declare readonly guild: BushGuild | null;
+ public declare member: BushGuildMember | APIInteractionGuildMember | null;
+ public declare user: BushUser;
+}
diff --git a/src/lib/extensions/discord.js/BushDMChannel.ts b/src/lib/extensions/discord.js/BushDMChannel.ts
index 475f224..9bf814b 100644
--- a/src/lib/extensions/discord.js/BushDMChannel.ts
+++ b/src/lib/extensions/discord.js/BushDMChannel.ts
@@ -8,7 +8,7 @@ export class BushDMChannel extends DMChannel {
public declare messages: BushMessageManager;
public declare recipient: BushUser;
- constructor(client: BushClient, data?: unknown) {
+ public constructor(client: BushClient, data?: unknown) {
super(client, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushEmoji.ts b/src/lib/extensions/discord.js/BushEmoji.ts
new file mode 100644
index 0000000..ba48166
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushEmoji.ts
@@ -0,0 +1,9 @@
+import { Emoji } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+
+export class BushEmoji extends Emoji {
+ public declare readonly client: BushClient;
+ public constructor(client: BushClient, emoji: unknown) {
+ super(client, emoji);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts b/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts
new file mode 100644
index 0000000..d4c1337
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushGuildApplicationCommandManager.ts
@@ -0,0 +1,10 @@
+/* eslint-disable @typescript-eslint/no-explicit-any */
+import { GuildApplicationCommandManager } from 'discord.js';
+import { BushGuild } from './BushGuild';
+
+export class BushGuildApplicationCommandManager extends GuildApplicationCommandManager {
+ public guild: BushGuild;
+ public constructor(guild: BushGuild, iterable?: Iterable<any>) {
+ super(guild, iterable);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushGuildChannel.ts b/src/lib/extensions/discord.js/BushGuildChannel.ts
index 75b8a5f..7eada41 100644
--- a/src/lib/extensions/discord.js/BushGuildChannel.ts
+++ b/src/lib/extensions/discord.js/BushGuildChannel.ts
@@ -5,7 +5,7 @@ import { BushGuild } from './BushGuild';
export class BushGuildChannel extends GuildChannel {
public declare readonly client: BushClient;
public declare guild: BushGuild;
- constructor(guild: BushGuild, data?: unknown) {
+ public constructor(guild: BushGuild, data?: unknown) {
super(guild, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushGuildEmoji.ts b/src/lib/extensions/discord.js/BushGuildEmoji.ts
index 8c97ada..c03c1b5 100644
--- a/src/lib/extensions/discord.js/BushGuildEmoji.ts
+++ b/src/lib/extensions/discord.js/BushGuildEmoji.ts
@@ -9,7 +9,7 @@ export class BushGuildEmoji extends GuildEmoji {
public declare guild: BushGuild;
public declare author: BushUser | null;
public declare readonly roles: BushGuildEmojiRoleManager;
- constructor(client: BushClient, data: unknown, guild: BushGuild) {
+ public constructor(client: BushClient, data: unknown, guild: BushGuild) {
super(client, data, guild);
}
}
diff --git a/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts b/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts
index 86c2492..00afb25 100644
--- a/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts
+++ b/src/lib/extensions/discord.js/BushGuildEmojiRoleManager.ts
@@ -7,7 +7,7 @@ export class BushGuildEmojiRoleManager extends GuildEmojiRoleManager {
public declare emoji: BushGuildEmoji;
public declare guild: BushGuild;
public declare cache: Collection<Snowflake, BushRole>;
- constructor(emoji: BushGuildEmoji) {
+ public constructor(emoji: BushGuildEmoji) {
super(emoji);
}
}
diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts
index e4380f7..db68a19 100644
--- a/src/lib/extensions/discord.js/BushMessage.ts
+++ b/src/lib/extensions/discord.js/BushMessage.ts
@@ -11,7 +11,7 @@ import { BushUser } from './BushUser';
export class BushMessage extends Message {
public declare readonly client: BushClient;
- public declare util: BushCommandUtil;
+ public util: BushCommandUtil;
public declare readonly guild: BushGuild;
public declare readonly member: BushGuildMember;
public declare author: BushUser;
@@ -22,5 +22,7 @@ export class BushMessage extends Message {
channel: BushTextChannel | BushDMChannel | BushNewsChannel | BushThreadChannel
) {
super(client, data, channel);
+ this.util = new BushCommandUtil(this.client.commandHandler, this);
+ this.client.console.debug(this.util);
}
}
diff --git a/src/lib/extensions/discord.js/BushMessageManager.ts b/src/lib/extensions/discord.js/BushMessageManager.ts
index c9256a9..efc6369 100644
--- a/src/lib/extensions/discord.js/BushMessageManager.ts
+++ b/src/lib/extensions/discord.js/BushMessageManager.ts
@@ -8,7 +8,7 @@ import { BushTextChannel } from './BushTextChannel';
export class BushMessageManager extends MessageManager {
public declare readonly client: BushClient;
public declare cache: Collection<Snowflake, BushMessage>;
- constructor(channel: BushTextChannel | BushDMChannel, iterable?: Iterable<any>) {
+ public constructor(channel: BushTextChannel | BushDMChannel, iterable?: Iterable<any>) {
super(channel, iterable);
}
}
diff --git a/src/lib/extensions/discord.js/BushMessageReaction.ts b/src/lib/extensions/discord.js/BushMessageReaction.ts
new file mode 100644
index 0000000..9958059
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushMessageReaction.ts
@@ -0,0 +1,14 @@
+import { MessageReaction } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushGuildEmoji } from './BushGuildEmoji';
+import { BushMessage } from './BushMessage';
+import { BushReactionEmoji } from './BushReactionEmoji';
+
+export class BushMessageReaction extends MessageReaction {
+ public readonly client: BushClient;
+ public readonly emoji: BushGuildEmoji | BushReactionEmoji;
+
+ public constructor(client: BushClient, data: unknown, message: BushMessage) {
+ super(client, data, message);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushNewsChannel.ts b/src/lib/extensions/discord.js/BushNewsChannel.ts
index 77b7a9d..b026b5e 100644
--- a/src/lib/extensions/discord.js/BushNewsChannel.ts
+++ b/src/lib/extensions/discord.js/BushNewsChannel.ts
@@ -10,7 +10,7 @@ export class BushNewsChannel extends NewsChannel {
public declare messages: BushMessageManager;
public declare threads: BushThreadManager;
// eslint-disable-next-line @typescript-eslint/ban-types
- constructor(guild: BushGuild, data?: object) {
+ public constructor(guild: BushGuild, data?: object) {
super(guild, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushPresence.ts b/src/lib/extensions/discord.js/BushPresence.ts
new file mode 100644
index 0000000..13c7567
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushPresence.ts
@@ -0,0 +1,15 @@
+import { Presence } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushGuild } from './BushGuild';
+import { BushGuildMember } from './BushGuildMember';
+import { BushUser } from './BushUser';
+
+export class BushPresence extends Presence {
+ public declare guild: BushGuild | null;
+ public declare readonly member: BushGuildMember | null;
+ public declare readonly user: BushUser | null;
+
+ public constructor(client: BushClient, data?: unknown) {
+ super(client, data);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushReactionEmoji.ts b/src/lib/extensions/discord.js/BushReactionEmoji.ts
new file mode 100644
index 0000000..a25c1b8
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushReactionEmoji.ts
@@ -0,0 +1,11 @@
+import { ReactionEmoji } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushMessageReaction } from './BushMessageReaction';
+
+export class BushReactionEmoji extends ReactionEmoji {
+ public declare readonly client: BushClient;
+ public declare reaction: BushMessageReaction;
+ public constructor(reaction: BushMessageReaction, emoji: unknown) {
+ super(reaction, emoji);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushRole.ts b/src/lib/extensions/discord.js/BushRole.ts
index ce8e9dc..1d502b2 100644
--- a/src/lib/extensions/discord.js/BushRole.ts
+++ b/src/lib/extensions/discord.js/BushRole.ts
@@ -7,7 +7,7 @@ export class BushRole extends Role {
public declare readonly client: BushClient;
public guild: BushGuild;
public readonly members: Collection<Snowflake, BushGuildMember>;
- constructor(client: BushClient, data: unknown, guild: BushGuild) {
+ public constructor(client: BushClient, data: unknown, guild: BushGuild) {
super(client, data, guild);
}
}
diff --git a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts
new file mode 100644
index 0000000..1dd1638
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts
@@ -0,0 +1,19 @@
+import { APIInteractionGuildMember } from 'discord-api-types/v8';
+import { PartialDMChannel, SelectMenuInteraction } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushDMChannel } from './BushDMChannel';
+import { BushGuild } from './BushGuild';
+import { BushGuildMember } from './BushGuildMember';
+import { BushNewsChannel } from './BushNewsChannel';
+import { BushTextChannel } from './BushTextChannel';
+import { BushUser } from './BushUser';
+
+export class BushSelectMenuInteraction extends SelectMenuInteraction {
+ public declare readonly channel: BushTextChannel | BushDMChannel | BushNewsChannel | PartialDMChannel | null;
+ public declare readonly guild: BushGuild | null;
+ public declare member: BushGuildMember | APIInteractionGuildMember | null;
+ public declare user: BushUser;
+ public constructor(client: BushClient, data: unknown) {
+ super(client, data);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushStageChannel.ts b/src/lib/extensions/discord.js/BushStageChannel.ts
new file mode 100644
index 0000000..5bd3f45
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushStageChannel.ts
@@ -0,0 +1,17 @@
+import { Collection, Snowflake, StageChannel } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushCategoryChannel } from './BushCategoryChannel';
+import { BushGuild } from './BushGuild';
+import { BushGuildMember } from './BushGuildMember';
+import { BushStageInstance } from './BushStageInstance';
+
+export class BushStageChannel extends StageChannel {
+ public declare readonly client: BushClient;
+ public declare readonly instance: BushStageInstance | null;
+ public declare readonly members: Collection<Snowflake, BushGuildMember>;
+ public declare guild: BushGuild;
+ public declare readonly parent: BushCategoryChannel | null;
+ public constructor(guild: BushGuild, data?: unknown) {
+ super(guild, data);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushStageInstance.ts b/src/lib/extensions/discord.js/BushStageInstance.ts
new file mode 100644
index 0000000..f162d33
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushStageInstance.ts
@@ -0,0 +1,13 @@
+import { StageInstance } from 'discord.js';
+import { BushClient } from '../discord-akairo/BushClient';
+import { BushGuild } from './BushGuild';
+import { BushStageChannel } from './BushStageChannel';
+
+export class BushStageInstance extends StageInstance {
+ public declare readonly client: BushClient;
+ public declare readonly channel: BushStageChannel | null;
+ public declare readonly guild: BushGuild | null;
+ public constructor(client: BushClient, data: unknown, channel: BushStageChannel) {
+ super(client, data, channel);
+ }
+}
diff --git a/src/lib/extensions/discord.js/BushStoreChannel.ts b/src/lib/extensions/discord.js/BushStoreChannel.ts
index 1a9b855..8ce22c0 100644
--- a/src/lib/extensions/discord.js/BushStoreChannel.ts
+++ b/src/lib/extensions/discord.js/BushStoreChannel.ts
@@ -10,7 +10,7 @@ export class BushStoreChannel extends StoreChannel {
public declare readonly members: Collection<Snowflake, BushGuildMember>;
public declare readonly parent: BushCategoryChannel | null;
- constructor(guild: BushGuild, data?: unknown) {
+ public constructor(guild: BushGuild, data?: unknown) {
super(guild, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushTextChannel.ts b/src/lib/extensions/discord.js/BushTextChannel.ts
index b58aa7b..26e3858 100644
--- a/src/lib/extensions/discord.js/BushTextChannel.ts
+++ b/src/lib/extensions/discord.js/BushTextChannel.ts
@@ -7,7 +7,7 @@ export class BushTextChannel extends TextChannel {
public declare readonly client: BushClient;
public declare guild: BushGuild;
public declare messages: BushMessageManager;
- constructor(guild: BushGuild, data?: unknown) {
+ public constructor(guild: BushGuild, data?: unknown) {
super(guild, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushThreadChannel.ts b/src/lib/extensions/discord.js/BushThreadChannel.ts
index 10fc65e..9f6e84b 100644
--- a/src/lib/extensions/discord.js/BushThreadChannel.ts
+++ b/src/lib/extensions/discord.js/BushThreadChannel.ts
@@ -17,7 +17,7 @@ export class BushThreadChannel extends ThreadChannel {
public declare readonly guildMembers: Collection<Snowflake, BushGuildMember>;
public declare readonly parent: BushTextChannel | BushNewsChannel | null;
- constructor(guild: BushGuild, data?: object) {
+ public constructor(guild: BushGuild, data?: object) {
super(guild, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushThreadManager.ts b/src/lib/extensions/discord.js/BushThreadManager.ts
index 408ac7f..76eaf22 100644
--- a/src/lib/extensions/discord.js/BushThreadManager.ts
+++ b/src/lib/extensions/discord.js/BushThreadManager.ts
@@ -5,7 +5,7 @@ import { BushTextChannel } from './BushTextChannel';
export class BushThreadManager extends ThreadManager {
public declare channel: BushTextChannel | BushNewsChannel;
- constructor(channel: BushTextChannel | BushNewsChannel, iterable?: Iterable<any>) {
+ public constructor(channel: BushTextChannel | BushNewsChannel, iterable?: Iterable<any>) {
super(channel, iterable);
}
}
diff --git a/src/lib/extensions/discord.js/BushThreadMember.ts b/src/lib/extensions/discord.js/BushThreadMember.ts
index 16da663..4ef51ae 100644
--- a/src/lib/extensions/discord.js/BushThreadMember.ts
+++ b/src/lib/extensions/discord.js/BushThreadMember.ts
@@ -8,7 +8,7 @@ export class BushThreadMember extends ThreadMember {
public declare readonly guildMember: BushGuildMember | null;
public declare readonly user: BushUser | null;
public declare thread: BushThreadChannel;
- constructor(thread: BushThreadChannel, data?: object) {
+ public constructor(thread: BushThreadChannel, data?: object) {
super(thread, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushThreadMemberManager.ts b/src/lib/extensions/discord.js/BushThreadMemberManager.ts
index 7c7bb6d..e375322 100644
--- a/src/lib/extensions/discord.js/BushThreadMemberManager.ts
+++ b/src/lib/extensions/discord.js/BushThreadMemberManager.ts
@@ -17,7 +17,7 @@ export class BushThreadMemberManager extends ThreadMemberManager {
public declare thread: BushThreadChannel;
public declare readonly client: BushClient;
- constructor(thread: BushThreadChannel, iterable?: Iterable<any>) {
+ public constructor(thread: BushThreadChannel, iterable?: Iterable<any>) {
super(thread, iterable);
}
}
diff --git a/src/lib/extensions/discord.js/BushVoiceChannel.ts b/src/lib/extensions/discord.js/BushVoiceChannel.ts
index 7510b69..82a68b1 100644
--- a/src/lib/extensions/discord.js/BushVoiceChannel.ts
+++ b/src/lib/extensions/discord.js/BushVoiceChannel.ts
@@ -6,7 +6,7 @@ import { BushGuildMember } from './BushGuildMember';
export class BushVoiceChannel extends VoiceChannel {
public declare readonly client: BushClient;
public declare readonly members: Collection<Snowflake, BushGuildMember>;
- constructor(guild: BushGuild, data?: unknown) {
+ public constructor(guild: BushGuild, data?: unknown) {
super(guild, data);
}
}
diff --git a/src/lib/extensions/discord.js/BushVoiceState.ts b/src/lib/extensions/discord.js/BushVoiceState.ts
new file mode 100644
index 0000000..d93fa13
--- /dev/null
+++ b/src/lib/extensions/discord.js/BushVoiceState.ts
@@ -0,0 +1,14 @@
+import { VoiceState } from 'discord.js';
+import { BushGuild } from './BushGuild';
+import { BushGuildMember } from './BushGuildMember';
+import { BushStageChannel } from './BushStageChannel';
+import { BushVoiceChannel } from './BushVoiceChannel';
+
+export class BushVoiceState extends VoiceState {
+ public readonly channel: BushVoiceChannel | BushStageChannel | null;
+ public guild: BushGuild;
+ public readonly member: BushGuildMember | null;
+ public constructor(guild: BushGuild, data: unknown) {
+ super(guild, data);
+ }
+}
diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts
index 7293c41..915d8f1 100644
--- a/src/lib/utils/BushLogger.ts
+++ b/src/lib/utils/BushLogger.ts
@@ -29,9 +29,9 @@ export class BushLogger {
return tempParsedArray.join('');
}
- private inspectContent(content: any, depth = 2): string {
+ private inspectContent(content: any, depth = 2, colors = true): string {
if (typeof content !== 'string') {
- return inspect(content, { depth });
+ return inspect(content, { depth, colors });
}
return content;
}
@@ -61,7 +61,8 @@ export class BushLogger {
* Logs information. Highlight information by surrounding it in `<<>>`.
* @param header - The header displayed before the content, displayed in cyan.
* @param content - The content to log, highlights displayed in bright blue.
- * @param sendChannel - Should this also be logged to discord? Defaults to true.
+ * @param sendChannel - Should this also be logged to discord? Defaults to false.
+ * @param depth - The depth the content will inspected. Defaults to 0.
*/
public get log() {
return this.info;
@@ -82,8 +83,19 @@ export class BushLogger {
/**
* Logs debug information. Only works in dev is enabled in the config.
* @param content - The content to log.
+ * @param depth - The depth the content will inspected. Defaults to 0.
*/
- public debug(...content: any): void {
+ public debug(content: any, depth = 0): void {
+ if (!this.client.config.dev) return;
+ const newContent = this.inspectContent(content, depth, true);
+ console.log(`${chalk.bgMagenta(this.getTimeStamp())} ${chalk.magenta('[Debug]')}`, newContent);
+ }
+
+ /**
+ * Logs raw debug information. Only works in dev is enabled in the config.
+ * @param content - The content to log.
+ */
+ public debugRaw(...content: any): void {
if (!this.client.config.dev) return;
console.log(`${chalk.bgMagenta(this.getTimeStamp())} ${chalk.magenta('[Debug]')}`, ...content);
}
@@ -92,11 +104,12 @@ export class BushLogger {
* Logs verbose information. Highlight information by surrounding it in `<<>>`.
* @param header - The header printed before the content, displayed in grey.
* @param content - The content to log, highlights displayed in bright black.
- * @param sendChannel = false - Should this also be logged to discord? Defaults to false.
+ * @param sendChannel - Should this also be logged to discord? Defaults to false.
+ * @param depth - The depth the content will inspected. Defaults to 0.
*/
- public async verbose(header: string, content: any, sendChannel = false): Promise<void> {
+ public async verbose(header: string, content: any, sendChannel = false, depth = 0): Promise<void> {
if (!this.client.config.logging.verbose) return;
- const newContent = this.inspectContent(content);
+ const newContent = this.inspectContent(content, depth, true);
console.info(
`${chalk.bgGrey(this.getTimeStamp())} ${chalk.grey(`[${header}]`)} ` + this.parseFormatting(newContent, 'blackBright')
);
@@ -112,11 +125,12 @@ export class BushLogger {
* Logs information. Highlight information by surrounding it in `<<>>`.
* @param header - The header displayed before the content, displayed in cyan.
* @param content - The content to log, highlights displayed in bright blue.
- * @param sendChannel - Should this also be logged to discord? Defaults to true.
+ * @param sendChannel - Should this also be logged to discord? Defaults to false.
+ * @param depth - The depth the content will inspected. Defaults to 0.
*/
- public async info(header: string, content: any, sendChannel = true): Promise<void> {
+ public async info(header: string, content: any, sendChannel = true, depth = 0): Promise<void> {
if (!this.client.config.logging.info) return;
- const newContent = this.inspectContent(content);
+ const newContent = this.inspectContent(content, depth, true);
console.info(
`${chalk.bgCyan(this.getTimeStamp())} ${chalk.cyan(`[${header}]`)} ` + this.parseFormatting(newContent, 'blueBright')
);
@@ -132,10 +146,11 @@ export class BushLogger {
* Logs warnings. Highlight information by surrounding it in `<<>>`.
* @param header - The header displayed before the content, displayed in yellow.
* @param content - The content to log, highlights displayed in bright yellow.
- * @param sendChannel - Should this also be logged to discord? Defaults to true.
+ * @param sendChannel - Should this also be logged to discord? Defaults to false.
+ * @param depth - The depth the content will inspected. Defaults to 0.
*/
- public async warn(header: string, content: any, sendChannel = true): Promise<void> {
- const newContent = this.inspectContent(content);
+ public async warn(header: string, content: any, sendChannel = true, depth = 0): Promise<void> {
+ const newContent = this.inspectContent(content, depth, true);
console.warn(
`${chalk.bgYellow(this.getTimeStamp())} ${chalk.yellow(`[${header}]`)} ` +
this.parseFormatting(newContent, 'yellowBright')
@@ -153,10 +168,11 @@ export class BushLogger {
* Logs errors. Highlight information by surrounding it in `<<>>`.
* @param header - The header displayed before the content, displayed in bright red.
* @param content - The content to log, highlights displayed in bright red.
- * @param sendChannel - Should this also be logged to discord? Defaults to true.
+ * @param sendChannel - Should this also be logged to discord? Defaults to false.
+ * @param depth - The depth the content will inspected. Defaults to 0.
*/
- public async error(header: string, content: any, sendChannel = true): Promise<void> {
- const newContent = this.inspectContent(content);
+ public async error(header: string, content: any, sendChannel = true, depth = 0): Promise<void> {
+ const newContent = this.inspectContent(content, depth, true);
console.error(
`${chalk.bgRedBright(this.getTimeStamp())} ${chalk.redBright(`[${header}]`)} ` +
this.parseFormatting(newContent, 'redBright')
@@ -173,10 +189,11 @@ export class BushLogger {
* Logs successes. Highlight information by surrounding it in `<<>>`.
* @param header - The header displayed before the content, displayed in green.
* @param content - The content to log, highlights displayed in bright green.
- * @param sendChannel - Should this also be logged to discord? Defaults to true.
+ * @param sendChannel - Should this also be logged to discord? Defaults to false.
+ * @param depth - The depth the content will inspected. Defaults to 0.
*/
- public async success(header: string, content: any, sendChannel = true): Promise<void> {
- const newContent = this.inspectContent(content);
+ public async success(header: string, content: any, sendChannel = true, depth = 0): Promise<void> {
+ const newContent = this.inspectContent(content, depth, true);
console.log(
`${chalk.bgGreen(this.getTimeStamp())} ${chalk.greenBright(`[${header}]`)} ` +
this.parseFormatting(newContent, 'greenBright')
diff --git a/src/lib/utils/CanvasProgressBar.ts b/src/lib/utils/CanvasProgressBar.ts
index d870bf9..521a444 100644
--- a/src/lib/utils/CanvasProgressBar.ts
+++ b/src/lib/utils/CanvasProgressBar.ts
@@ -9,7 +9,7 @@ export class CanvasProgressBar {
private p: number;
private ctx: CanvasRenderingContext2D;
- constructor(
+ public constructor(
ctx: CanvasRenderingContext2D,
dimension: { x: number; y: number; width: number; height: number },
color: string,