diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-28 21:51:17 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-28 21:51:17 -0400 |
commit | 14eb0e617b084080c4cffc5b781b311c65c5f928 (patch) | |
tree | 9aaf1734c1e739814a913afeda40c56b0f84df61 /lib/extensions/discord-akairo | |
parent | 03b26d5f00422f3aaddce3db2186765863b1eca0 (diff) | |
download | tanzanite-14eb0e617b084080c4cffc5b781b311c65c5f928.tar.gz tanzanite-14eb0e617b084080c4cffc5b781b311c65c5f928.tar.bz2 tanzanite-14eb0e617b084080c4cffc5b781b311c65c5f928.zip |
rebrand v3
Diffstat (limited to 'lib/extensions/discord-akairo')
17 files changed, 146 insertions, 157 deletions
diff --git a/lib/extensions/discord-akairo/BotArgumentTypeCaster.ts b/lib/extensions/discord-akairo/BotArgumentTypeCaster.ts new file mode 100644 index 0000000..5f4f32f --- /dev/null +++ b/lib/extensions/discord-akairo/BotArgumentTypeCaster.ts @@ -0,0 +1,3 @@ +import { type CommandMessage } from '#lib'; + +export type BotArgumentTypeCaster<R = unknown> = (message: CommandMessage, phrase: string) => R; diff --git a/lib/extensions/discord-akairo/BushCommand.ts b/lib/extensions/discord-akairo/BotCommand.ts index 7201248..abd945e 100644 --- a/lib/extensions/discord-akairo/BushCommand.ts +++ b/lib/extensions/discord-akairo/BotCommand.ts @@ -1,12 +1,12 @@ import { type DiscordEmojiInfo, type RoleWithDuration } from '#args'; import { - type BushArgumentTypeCaster, - type BushClient, - type BushCommandHandler, - type BushInhibitor, - type BushListener, - type BushTask, - type ParsedDuration + type BotArgumentTypeCaster, + type BotCommandHandler, + type BotInhibitor, + type BotListener, + type BotTask, + type ParsedDuration, + type TanzaniteClient } from '#lib'; import { ArgumentMatch, @@ -45,15 +45,15 @@ import _ from 'lodash'; import { SlashMessage } from './SlashMessage.js'; export interface OverriddenBaseArgumentType extends BaseArgumentType { - commandAlias: BushCommand | null; - command: BushCommand | null; - inhibitor: BushInhibitor | null; - listener: BushListener | null; - task: BushTask | null; + commandAlias: BotCommand | null; + command: BotCommand | null; + inhibitor: BotInhibitor | null; + listener: BotListener | null; + task: BotTask | null; contextMenuCommand: ContextMenuCommand | null; } -export interface BaseBushArgumentType extends OverriddenBaseArgumentType { +export interface BaseBotArgumentType extends OverriddenBaseArgumentType { duration: number | null; contentWithDuration: ParsedDuration; permission: PermissionsString | null; @@ -67,9 +67,9 @@ export interface BaseBushArgumentType extends OverriddenBaseArgumentType { tinyColor: string | null; } -export type BushArgumentType = keyof BaseBushArgumentType | RegExp; +export type BotArgumentType = keyof BaseBotArgumentType | RegExp; -interface BaseBushArgumentOptions extends Omit<ArgumentOptions, 'type' | 'prompt'>, ExtraArgumentOptions { +interface BaseBotArgumentOptions extends Omit<ArgumentOptions, 'type' | 'prompt'>, ExtraArgumentOptions { id: string; description: string; @@ -150,7 +150,7 @@ interface ExtraArgumentOptions { superUserOnly?: boolean; } -export interface BushArgumentOptions extends BaseBushArgumentOptions { +export interface BotArgumentOptions extends BaseBotArgumentOptions { /** * The type that the argument should be cast to. * - `string` does not cast to any type. @@ -199,10 +199,10 @@ export interface BushArgumentOptions extends BaseBushArgumentOptions { * - `contentWithDuration` tries to parse duration in milliseconds and returns the remaining content with the duration * removed */ - type?: BushArgumentType | (keyof BaseBushArgumentType)[] | BushArgumentTypeCaster; + type?: BotArgumentType | (keyof BaseBotArgumentType)[] | BotArgumentTypeCaster; } -export interface CustomBushArgumentOptions extends BaseBushArgumentOptions { +export interface CustomBotArgumentOptions extends BaseBotArgumentOptions { /** * An array of strings can be used to restrict input to only those strings, case insensitive. * The array can also contain an inner array of strings, for aliases. @@ -214,7 +214,7 @@ export interface CustomBushArgumentOptions extends BaseBushArgumentOptions { customType?: (string | string[])[] | RegExp | string | null; } -export type BushMissingPermissionSupplier = (message: CommandMessage | SlashMessage) => Promise<any> | any; +export type CustomMissingPermissionSupplier = (message: CommandMessage | SlashMessage) => Promise<any> | any; interface ExtendedCommandOptions { /** @@ -253,7 +253,7 @@ interface ExtendedCommandOptions { bypassChannelBlacklist?: boolean; /** - * Use instead of {@link BaseBushCommandOptions.args} when using argument generators or custom slashOptions + * Use instead of {@link BaseBotCommandOptions.args} when using argument generators or custom slashOptions */ helpArgs?: ArgsInfo[]; @@ -263,7 +263,7 @@ interface ExtendedCommandOptions { note?: string; } -export interface BaseBushCommandOptions +export interface BaseBotCommandOptions extends Omit<CommandOptions, 'userPermissions' | 'clientPermissions' | 'args'>, ExtendedCommandOptions { /** @@ -274,19 +274,19 @@ export interface BaseBushCommandOptions /** * The arguments for the command. */ - args?: BushArgumentOptions[] & CustomBushArgumentOptions[]; + args?: BotArgumentOptions[] & CustomBotArgumentOptions[]; category: string; /** * Permissions required by the client to run this command. */ - clientPermissions: bigint | bigint[] | BushMissingPermissionSupplier; + clientPermissions: bigint | bigint[] | CustomMissingPermissionSupplier; /** * Permissions required by the user to run this command. */ - userPermissions: bigint | bigint[] | BushMissingPermissionSupplier; + userPermissions: bigint | bigint[] | CustomMissingPermissionSupplier; /** * Whether the argument is only accessible to the owners. @@ -299,7 +299,7 @@ export interface BaseBushCommandOptions superUserOnly?: boolean; } -export type BushCommandOptions = Omit<BaseBushCommandOptions, 'helpArgs'> | Omit<BaseBushCommandOptions, 'args'>; +export type CustomCommandOptions = Omit<BaseBotCommandOptions, 'helpArgs'> | Omit<BaseBotCommandOptions, 'args'>; export interface ArgsInfo { /** @@ -360,9 +360,9 @@ export interface ArgsInfo { superUserOnly?: boolean; } -export abstract class BushCommand extends Command { - public declare client: BushClient; - public declare handler: BushCommandHandler; +export abstract class BotCommand extends Command { + public declare client: TanzaniteClient; + public declare handler: BotCommandHandler; public declare description: string; /** @@ -378,7 +378,7 @@ export abstract class BushCommand extends Command { /** * The options sent to the constructor */ - public options: BushCommandOptions; + public options: CustomCommandOptions; /** * The options sent to the super call @@ -420,8 +420,8 @@ export abstract class BushCommand extends Command { */ public note?: string; - public constructor(id: string, options: BushCommandOptions) { - const options_ = options as BaseBushCommandOptions; + public constructor(id: string, options: CustomCommandOptions) { + const options_ = options as BaseBotCommandOptions; if (options_.args && typeof options_.args !== 'function') { options_.args.forEach((_, index: number) => { @@ -512,8 +512,8 @@ export abstract class BushCommand extends Command { const argsInfo: ArgsInfo[] = []; const combined = (options_.args ?? options_.helpArgs)!.map((arg) => { const norm = options_.args - ? options_.args.find((_arg) => _arg.id === ('id' in arg ? arg.id : arg.name)) ?? ({} as BushArgumentOptions) - : ({} as BushArgumentOptions); + ? options_.args.find((_arg) => _arg.id === ('id' in arg ? arg.id : arg.name)) ?? ({} as BotArgumentOptions) + : ({} as BotArgumentOptions); const help = options_.helpArgs ? options_.helpArgs.find((_arg) => _arg.name === ('id' in arg ? arg.id : arg.name)) ?? ({} as ArgsInfo) : ({} as ArgsInfo); @@ -574,7 +574,7 @@ type SlashOptionKeys = | keyof AkairoApplicationCommandNumericOptionData | keyof AkairoApplicationCommandSubCommandData; -interface PseudoArguments extends BaseBushArgumentType { +interface PseudoArguments extends BaseBotArgumentType { boolean: boolean; flag: boolean; regex: { match: RegExpMatchArray; matches: RegExpExecArray[] }; diff --git a/lib/extensions/discord-akairo/BotCommandHandler.ts b/lib/extensions/discord-akairo/BotCommandHandler.ts new file mode 100644 index 0000000..8a4fe60 --- /dev/null +++ b/lib/extensions/discord-akairo/BotCommandHandler.ts @@ -0,0 +1,37 @@ +import { type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { CommandHandler, type Category, type CommandHandlerEvents, type CommandHandlerOptions } from 'discord-akairo'; +import { type Collection, type Message, type PermissionsString } from 'discord.js'; + +export type CustomCommandHandlerOptions = CommandHandlerOptions; + +export interface BotCommandHandlerEvents extends CommandHandlerEvents { + commandBlocked: [message: CommandMessage, command: BotCommand, reason: string]; + commandBreakout: [message: CommandMessage, command: BotCommand, /* no util */ breakMessage: Message]; + commandCancelled: [message: CommandMessage, command: BotCommand, /* no util */ retryMessage?: Message]; + commandFinished: [message: CommandMessage, command: BotCommand, args: any, returnValue: any]; + commandInvalid: [message: CommandMessage, command: BotCommand]; + commandLocked: [message: CommandMessage, command: BotCommand]; + commandStarted: [message: CommandMessage, command: BotCommand, args: any]; + cooldown: [message: CommandMessage | SlashMessage, command: BotCommand, remaining: number]; + error: [error: Error, message: /* no util */ Message, command?: BotCommand]; + inPrompt: [message: /* no util */ Message]; + load: [command: BotCommand, isReload: boolean]; + messageBlocked: [message: /* no util */ Message | CommandMessage | SlashMessage, reason: string]; + messageInvalid: [message: CommandMessage]; + missingPermissions: [message: CommandMessage, command: BotCommand, type: 'client' | 'user', missing: PermissionsString[]]; + remove: [command: BotCommand]; + slashBlocked: [message: SlashMessage, command: BotCommand, reason: string]; + slashError: [error: Error, message: SlashMessage, command: BotCommand]; + slashFinished: [message: SlashMessage, command: BotCommand, args: any, returnValue: any]; + slashMissingPermissions: [message: SlashMessage, command: BotCommand, type: 'client' | 'user', missing: PermissionsString[]]; + slashStarted: [message: SlashMessage, command: BotCommand, args: any]; +} + +export class BotCommandHandler extends CommandHandler { + public declare modules: Collection<string, BotCommand>; + public declare categories: Collection<string, Category<string, BotCommand>>; +} + +export interface BotCommandHandler extends CommandHandler { + findCommand(name: string): BotCommand; +} diff --git a/lib/extensions/discord-akairo/BushInhibitor.ts b/lib/extensions/discord-akairo/BotInhibitor.ts index be396cf..d134eab 100644 --- a/lib/extensions/discord-akairo/BushInhibitor.ts +++ b/lib/extensions/discord-akairo/BotInhibitor.ts @@ -1,9 +1,8 @@ -import { type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; import { Inhibitor } from 'discord-akairo'; -// eslint-disable-next-line @typescript-eslint/no-unused-vars import { Message } from 'discord.js'; -export abstract class BushInhibitor extends Inhibitor { +export abstract class BotInhibitor extends Inhibitor { /** * Checks if message should be blocked. * A return value of true will block the message. @@ -14,6 +13,6 @@ export abstract class BushInhibitor extends Inhibitor { * @param message - Message being handled. * @param command - Command to check. */ - public abstract override exec(message: CommandMessage, command: BushCommand): any; - public abstract override exec(message: CommandMessage | SlashMessage, command: BushCommand): any; + public abstract override exec(message: CommandMessage, command: BotCommand): any; + public abstract override exec(message: CommandMessage | SlashMessage, command: BotCommand): any; } diff --git a/lib/extensions/discord-akairo/BotInhibitorHandler.ts b/lib/extensions/discord-akairo/BotInhibitorHandler.ts new file mode 100644 index 0000000..c6f318d --- /dev/null +++ b/lib/extensions/discord-akairo/BotInhibitorHandler.ts @@ -0,0 +1,3 @@ +import { InhibitorHandler } from 'discord-akairo'; + +export class BotInhibitorHandler extends InhibitorHandler {} diff --git a/lib/extensions/discord-akairo/BotListener.ts b/lib/extensions/discord-akairo/BotListener.ts new file mode 100644 index 0000000..f4bfd6c --- /dev/null +++ b/lib/extensions/discord-akairo/BotListener.ts @@ -0,0 +1,3 @@ +import { Listener } from 'discord-akairo'; + +export abstract class BotListener extends Listener {} diff --git a/lib/extensions/discord-akairo/BotListenerHandler.ts b/lib/extensions/discord-akairo/BotListenerHandler.ts new file mode 100644 index 0000000..9b3b525 --- /dev/null +++ b/lib/extensions/discord-akairo/BotListenerHandler.ts @@ -0,0 +1,3 @@ +import { ListenerHandler } from 'discord-akairo'; + +export class BotListenerHandler extends ListenerHandler {} diff --git a/lib/extensions/discord-akairo/BotTask.ts b/lib/extensions/discord-akairo/BotTask.ts new file mode 100644 index 0000000..09b30ed --- /dev/null +++ b/lib/extensions/discord-akairo/BotTask.ts @@ -0,0 +1,3 @@ +import { Task } from 'discord-akairo'; + +export abstract class BotTask extends Task {} diff --git a/lib/extensions/discord-akairo/BotTaskHandler.ts b/lib/extensions/discord-akairo/BotTaskHandler.ts new file mode 100644 index 0000000..b522f2c --- /dev/null +++ b/lib/extensions/discord-akairo/BotTaskHandler.ts @@ -0,0 +1,3 @@ +import { TaskHandler } from 'discord-akairo'; + +export class BotTaskHandler extends TaskHandler {} diff --git a/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts b/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts deleted file mode 100644 index def7ad6..0000000 --- a/lib/extensions/discord-akairo/BushArgumentTypeCaster.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { type CommandMessage } from '#lib'; - -export type BushArgumentTypeCaster<R = unknown> = (message: CommandMessage, phrase: string) => R; diff --git a/lib/extensions/discord-akairo/BushCommandHandler.ts b/lib/extensions/discord-akairo/BushCommandHandler.ts deleted file mode 100644 index da49af9..0000000 --- a/lib/extensions/discord-akairo/BushCommandHandler.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { type BushCommand, type CommandMessage, type SlashMessage } from '#lib'; -import { CommandHandler, type Category, type CommandHandlerEvents, type CommandHandlerOptions } from 'discord-akairo'; -import { type Collection, type Message, type PermissionsString } from 'discord.js'; - -export type BushCommandHandlerOptions = CommandHandlerOptions; - -export interface BushCommandHandlerEvents extends CommandHandlerEvents { - commandBlocked: [message: CommandMessage, command: BushCommand, reason: string]; - commandBreakout: [message: CommandMessage, command: BushCommand, /* no util */ breakMessage: Message]; - commandCancelled: [message: CommandMessage, command: BushCommand, /* no util */ retryMessage?: Message]; - commandFinished: [message: CommandMessage, command: BushCommand, args: any, returnValue: any]; - commandInvalid: [message: CommandMessage, command: BushCommand]; - commandLocked: [message: CommandMessage, command: BushCommand]; - commandStarted: [message: CommandMessage, command: BushCommand, args: any]; - cooldown: [message: CommandMessage | SlashMessage, command: BushCommand, remaining: number]; - error: [error: Error, message: /* no util */ Message, command?: BushCommand]; - inPrompt: [message: /* no util */ Message]; - load: [command: BushCommand, isReload: boolean]; - messageBlocked: [message: /* no util */ Message | CommandMessage | SlashMessage, reason: string]; - messageInvalid: [message: CommandMessage]; - missingPermissions: [message: CommandMessage, command: BushCommand, type: 'client' | 'user', missing: PermissionsString[]]; - remove: [command: BushCommand]; - slashBlocked: [message: SlashMessage, command: BushCommand, reason: string]; - slashError: [error: Error, message: SlashMessage, command: BushCommand]; - slashFinished: [message: SlashMessage, command: BushCommand, args: any, returnValue: any]; - slashMissingPermissions: [message: SlashMessage, command: BushCommand, type: 'client' | 'user', missing: PermissionsString[]]; - slashStarted: [message: SlashMessage, command: BushCommand, args: any]; -} - -export class BushCommandHandler extends CommandHandler { - public declare modules: Collection<string, BushCommand>; - public declare categories: Collection<string, Category<string, BushCommand>>; -} - -export interface BushCommandHandler extends CommandHandler { - findCommand(name: string): BushCommand; -} diff --git a/lib/extensions/discord-akairo/BushInhibitorHandler.ts b/lib/extensions/discord-akairo/BushInhibitorHandler.ts deleted file mode 100644 index 5e4fb6c..0000000 --- a/lib/extensions/discord-akairo/BushInhibitorHandler.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { InhibitorHandler } from 'discord-akairo'; - -export class BushInhibitorHandler extends InhibitorHandler {} diff --git a/lib/extensions/discord-akairo/BushListener.ts b/lib/extensions/discord-akairo/BushListener.ts deleted file mode 100644 index 6917641..0000000 --- a/lib/extensions/discord-akairo/BushListener.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Listener } from 'discord-akairo'; - -export abstract class BushListener extends Listener {} diff --git a/lib/extensions/discord-akairo/BushListenerHandler.ts b/lib/extensions/discord-akairo/BushListenerHandler.ts deleted file mode 100644 index 9c3e4af..0000000 --- a/lib/extensions/discord-akairo/BushListenerHandler.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { ListenerHandler } from 'discord-akairo'; - -export class BushListenerHandler extends ListenerHandler {} diff --git a/lib/extensions/discord-akairo/BushTask.ts b/lib/extensions/discord-akairo/BushTask.ts deleted file mode 100644 index 1b70c88..0000000 --- a/lib/extensions/discord-akairo/BushTask.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Task } from 'discord-akairo'; - -export abstract class BushTask extends Task {} diff --git a/lib/extensions/discord-akairo/BushTaskHandler.ts b/lib/extensions/discord-akairo/BushTaskHandler.ts deleted file mode 100644 index 6535abb..0000000 --- a/lib/extensions/discord-akairo/BushTaskHandler.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { TaskHandler } from 'discord-akairo'; - -export class BushTaskHandler extends TaskHandler {} diff --git a/lib/extensions/discord-akairo/BushClient.ts b/lib/extensions/discord-akairo/TanzaniteClient.ts index b311ffd..24ce962 100644 --- a/lib/extensions/discord-akairo/BushClient.ts +++ b/lib/extensions/discord-akairo/TanzaniteClient.ts @@ -11,7 +11,7 @@ import { snowflake } from '#args'; import type { Config } from '#config'; -import { BushClientEvents, emojis, formatError, inspect, updateEveryCache } from '#lib'; +import { BotClientEvents, emojis, formatError, inspect, updateEveryCache } from '#lib'; import { patch, type PatchedElements } from '@notenoughupdates/events-intercept'; import * as Sentry from '@sentry/node'; import { @@ -32,14 +32,10 @@ import { version as discordJsVersion, type Awaitable, type If, - type InteractionReplyOptions, type Message, - type MessageEditOptions, type MessageOptions, - type ReplyMessageOptions, type Snowflake, - type UserResolvable, - type WebhookEditMessageOptions + type UserResolvable } from 'discord.js'; import type EventEmitter from 'events'; import { google } from 'googleapis'; @@ -48,7 +44,7 @@ import readline from 'readline'; import { Options as SequelizeOptions, Sequelize, Sequelize as SequelizeType } from 'sequelize'; import { fileURLToPath } from 'url'; import { tinyColor } from '../../arguments/tinyColor.js'; -import { BushCache } from '../../common/BushCache.js'; +import { BotCache } from '../../common/BotCache.js'; import { HighlightManager } from '../../common/HighlightManager.js'; import { ActivePunishment, @@ -65,16 +61,16 @@ import { StickyRole } from '../../models/index.js'; import { AllowedMentions } from '../../utils/AllowedMentions.js'; -import { BushClientUtils } from '../../utils/BushClientUtils.js'; -import { BushLogger } from '../../utils/BushLogger.js'; +import { BotClientUtils } from '../../utils/BotClientUtils.js'; +import { Logger } from '../../utils/Logger.js'; import { ExtendedGuild } from '../discord.js/ExtendedGuild.js'; import { ExtendedGuildMember } from '../discord.js/ExtendedGuildMember.js'; import { ExtendedMessage } from '../discord.js/ExtendedMessage.js'; import { ExtendedUser } from '../discord.js/ExtendedUser.js'; -import { BushCommandHandler } from './BushCommandHandler.js'; -import { BushInhibitorHandler } from './BushInhibitorHandler.js'; -import { BushListenerHandler } from './BushListenerHandler.js'; -import { BushTaskHandler } from './BushTaskHandler.js'; +import { BotCommandHandler } from './BotCommandHandler.js'; +import { BotInhibitorHandler } from './BotInhibitorHandler.js'; +import { BotListenerHandler } from './BotListenerHandler.js'; +import { BotTaskHandler } from './BotTaskHandler.js'; declare module 'discord.js' { export interface Client extends EventEmitter { @@ -87,15 +83,15 @@ declare module 'discord.js' { /** The configuration for the client. */ readonly config: Config; /** Stats for the client. */ - readonly stats: BushStats; + readonly stats: BotStats; /** The handler for the bot's listeners. */ - readonly listenerHandler: BushListenerHandler; + readonly listenerHandler: BotListenerHandler; /** The handler for the bot's command inhibitors. */ - readonly inhibitorHandler: BushInhibitorHandler; + readonly inhibitorHandler: BotInhibitorHandler; /** The handler for the bot's commands. */ - readonly commandHandler: BushCommandHandler; + readonly commandHandler: BotCommandHandler; /** The handler for the bot's tasks. */ - readonly taskHandler: BushTaskHandler; + readonly taskHandler: BotTaskHandler; /** The handler for the bot's context menu commands. */ readonly contextMenuCommandHandler: ContextMenuCommandHandler; /** The database connection for this instance of the bot (production, beta, or development). */ @@ -103,9 +99,9 @@ declare module 'discord.js' { /** The database connection that is shared between all instances of the bot. */ readonly sharedDB: SequelizeType; /** A custom logging system for the bot. */ - readonly logger: BushLogger; + readonly logger: Logger; /** Cached global and guild database data. */ - readonly cache: BushCache; + readonly cache: BotCache; /** Sentry error reporting for the bot. */ readonly sentry: typeof Sentry; /** Manages most aspects of the highlight command */ @@ -113,14 +109,14 @@ declare module 'discord.js' { /** The perspective api */ perspective: any; /** Client utilities. */ - readonly utils: BushClientUtils; + readonly utils: BotClientUtils; /** A custom logging system for the bot. */ - get console(): BushLogger; - on<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - once<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean; - off<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - removeAllListeners<K extends keyof BushClientEvents>(event?: K): this; + get console(): Logger; + on<K extends keyof BotClientEvents>(event: K, listener: (...args: BotClientEvents[K]) => Awaitable<void>): this; + once<K extends keyof BotClientEvents>(event: K, listener: (...args: BotClientEvents[K]) => Awaitable<void>): this; + emit<K extends keyof BotClientEvents>(event: K, ...args: BotClientEvents[K]): boolean; + off<K extends keyof BotClientEvents>(event: K, listener: (...args: BotClientEvents[K]) => Awaitable<void>): this; + removeAllListeners<K extends keyof BotClientEvents>(event?: K): this; /** * Checks if a user is the owner of this bot. * @param user - User to check. @@ -134,12 +130,6 @@ declare module 'discord.js' { } } -export type ReplyMessageType = string | MessagePayload | ReplyMessageOptions; -export type EditMessageType = string | MessageEditOptions | MessagePayload; -export type SlashSendMessageType = string | MessagePayload | InteractionReplyOptions; -export type SlashEditMessageType = string | MessagePayload | WebhookEditMessageOptions; -export type SendMessageType = string | MessagePayload | MessageOptions; - const rl = readline.createInterface({ input: process.stdin, output: process.stdout, @@ -151,7 +141,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); /** * The main hub for interacting with the Discord API. */ -export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Ready> { +export class TanzaniteClient<Ready extends boolean = boolean> extends AkairoClient<Ready> { public declare ownerID: Snowflake[]; public declare superUserID: Snowflake[]; @@ -163,27 +153,27 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re /** * Stats for the client. */ - public override readonly stats: BushStats = { cpu: undefined, commandsUsed: 0n, slashCommandsUsed: 0n }; + public override readonly stats: BotStats = { cpu: undefined, commandsUsed: 0n, slashCommandsUsed: 0n }; /** * The handler for the bot's listeners. */ - public override readonly listenerHandler: BushListenerHandler; + public override readonly listenerHandler: BotListenerHandler; /** * The handler for the bot's command inhibitors. */ - public override readonly inhibitorHandler: BushInhibitorHandler; + public override readonly inhibitorHandler: BotInhibitorHandler; /** * The handler for the bot's commands. */ - public override readonly commandHandler: BushCommandHandler; + public override readonly commandHandler: BotCommandHandler; /** * The handler for the bot's tasks. */ - public override readonly taskHandler: BushTaskHandler; + public override readonly taskHandler: BotTaskHandler; /** * The handler for the bot's context menu commands. @@ -203,12 +193,12 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re /** * A custom logging system for the bot. */ - public override readonly logger: BushLogger = new BushLogger(this); + public override readonly logger: Logger = new Logger(this); /** * Cached global and guild database data. */ - public override readonly cache = new BushCache(); + public override readonly cache = new BotCache(); /** * Sentry error reporting for the bot. @@ -228,7 +218,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re /** * Client utilities. */ - public override readonly utils: BushClientUtils = new BushClientUtils(this); + public override readonly utils: BotClientUtils = new BotClientUtils(this); /** * @param config The configuration for the client. @@ -268,17 +258,17 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re this.token = config.token as If<Ready, string, string | null>; /* =-=-= handlers =-=-= */ - this.listenerHandler = new BushListenerHandler(this, { + this.listenerHandler = new BotListenerHandler(this, { directory: path.join(__dirname, '..', '..', '..', 'src', 'listeners'), extensions: ['.js'], automateCategories: true }); - this.inhibitorHandler = new BushInhibitorHandler(this, { + this.inhibitorHandler = new BotInhibitorHandler(this, { directory: path.join(__dirname, '..', '..', '..', 'src', 'inhibitors'), extensions: ['.js'], automateCategories: true }); - this.taskHandler = new BushTaskHandler(this, { + this.taskHandler = new BotTaskHandler(this, { directory: path.join(__dirname, '..', '..', '..', 'src', 'tasks'), extensions: ['.js'], automateCategories: true @@ -309,7 +299,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re return options; }; - this.commandHandler = new BushCommandHandler(this, { + this.commandHandler = new BotCommandHandler(this, { directory: path.join(__dirname, '..', '..', '..', 'src', 'commands'), extensions: ['.js'], prefix: async ({ guild }: Message) => { @@ -372,7 +362,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re /** * A custom logging system for the bot. */ - public override get console(): BushLogger { + public override get console(): Logger { return this.logger; } @@ -558,18 +548,18 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re } } -export interface BushClient<Ready extends boolean = boolean> extends EventEmitter, PatchedElements, AkairoClient<Ready> { - on<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - once<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean; - off<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this; - removeAllListeners<K extends keyof BushClientEvents>(event?: K): this; +export interface TanzaniteClient<Ready extends boolean = boolean> extends EventEmitter, PatchedElements, AkairoClient<Ready> { + on<K extends keyof BotClientEvents>(event: K, listener: (...args: BotClientEvents[K]) => Awaitable<void>): this; + once<K extends keyof BotClientEvents>(event: K, listener: (...args: BotClientEvents[K]) => Awaitable<void>): this; + emit<K extends keyof BotClientEvents>(event: K, ...args: BotClientEvents[K]): boolean; + off<K extends keyof BotClientEvents>(event: K, listener: (...args: BotClientEvents[K]) => Awaitable<void>): this; + removeAllListeners<K extends keyof BotClientEvents>(event?: K): this; } /** * Various statistics */ -export interface BushStats { +export interface BotStats { /** * The average cpu usage of the bot from the past 60 seconds. */ @@ -587,15 +577,15 @@ export interface BushStats { } export interface Emitters { - client: BushClient; - commandHandler: BushClient['commandHandler']; - inhibitorHandler: BushClient['inhibitorHandler']; - listenerHandler: BushClient['listenerHandler']; - taskHandler: BushClient['taskHandler']; - contextMenuCommandHandler: BushClient['contextMenuCommandHandler']; + client: TanzaniteClient; + commandHandler: TanzaniteClient['commandHandler']; + inhibitorHandler: TanzaniteClient['inhibitorHandler']; + listenerHandler: TanzaniteClient['listenerHandler']; + taskHandler: TanzaniteClient['taskHandler']; + contextMenuCommandHandler: TanzaniteClient['contextMenuCommandHandler']; process: NodeJS.Process; stdin: readline.Interface; - gateway: BushClient['ws']; - rest: BushClient['rest']; - ws: BushClient['ws']; + gateway: TanzaniteClient['ws']; + rest: TanzaniteClient['rest']; + ws: TanzaniteClient['ws']; } |