From fce1fc87feb3e6dad1a956d757d856833c9ea5f6 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Mon, 22 Nov 2021 19:01:46 -0500 Subject: update contributors, fix formatting, added a bunch of repo forks --- src/lib/extensions/discord-akairo/BushClient.ts | 26 ++++++++-------- .../extensions/discord-akairo/BushClientUtil.ts | 36 ++++++++++------------ src/lib/extensions/discord-akairo/BushCommand.ts | 12 ++++++-- 3 files changed, 38 insertions(+), 36 deletions(-) (limited to 'src/lib/extensions/discord-akairo') diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 93ed9d7..59aea26 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -10,6 +10,7 @@ import type { BushUserManager, Config } from '#lib'; +import { patch, type PatchedElements } from '@notenoughupdates/events-intercept'; import * as Sentry from '@sentry/node'; import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo'; import { @@ -18,7 +19,9 @@ import { Structures, version as discordJsVersion, type Awaitable, - type Collection, type DMChannel, type InteractionReplyOptions, + type Collection, + type DMChannel, + type InteractionReplyOptions, type Message, type MessageEditOptions, type MessageOptions, @@ -28,8 +31,6 @@ import { type Snowflake, type WebhookEditMessageOptions } from 'discord.js'; -//@ts-ignore: no typings -import eventsIntercept from 'events-intercept'; import path from 'path'; import readline from 'readline'; import type { Sequelize as SequelizeType } from 'sequelize'; @@ -92,7 +93,7 @@ export type BushThreadMemberResolvable = BushThreadMember | BushUserResolvable; export type BushUserResolvable = BushUser | Snowflake | BushMessage | BushGuildMember | BushThreadMember; export type BushGuildMemberResolvable = BushGuildMember | BushUserResolvable; export type BushRoleResolvable = BushRole | Snowflake; -export type BushMessageResolvable = Message| BushMessage | Snowflake; +export type BushMessageResolvable = Message | BushMessage | Snowflake; export type BushEmojiResolvable = Snowflake | BushGuildEmoji | BushReactionEmoji; export type BushEmojiIdentifierResolvable = string | BushEmojiResolvable; export type BushThreadChannelResolvable = BushThreadChannel | Snowflake; @@ -157,6 +158,7 @@ export class BushClient extends AkairoClient; this.config = config; @@ -344,8 +346,6 @@ export class BushClient extends AkairoClient { await this.guilds.fetch(); const promises = this.guilds.cache.map((guild) => { @@ -386,23 +386,21 @@ export class BushClient extends AkairoClient(event: K, listener: (...args: BushClientEvents[K]) => Awaitable): this; - on(event: Exclude, listener: (...args: any[]) => Awaitable): this + on(event: Exclude, listener: (...args: any[]) => Awaitable): this; once(event: K, listener: (...args: BushClientEvents[K]) => Awaitable): this; - once(event: Exclude, listener: (...args: any[]) => Awaitable): this + once(event: Exclude, listener: (...args: any[]) => Awaitable): this; emit(event: K, ...args: BushClientEvents[K]): boolean; - emit(event: Exclude, ...args: unknown[]): boolean + emit(event: Exclude, ...args: unknown[]): boolean; off(event: K, listener: (...args: BushClientEvents[K]) => Awaitable): this; - off(event: Exclude, listener: (...args: any[]) => Awaitable): this + off(event: Exclude, listener: (...args: any[]) => Awaitable): this; removeAllListeners(event?: K): this; - removeAllListeners(event?: Exclude): this + removeAllListeners(event?: Exclude): this; } diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index f21d104..8f1e67a 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -16,6 +16,7 @@ import { type Pronoun, type PronounCode } from '#lib'; +import { humanizeDuration } from '@notenoughupdates/humanize-duration'; import { exec } from 'child_process'; import { ClientUtil, Util as AkairoUtil } from 'discord-akairo'; import { APIMessage } from 'discord-api-types'; @@ -40,7 +41,6 @@ import moment from 'moment'; import { inspect, promisify } from 'util'; import CommandErrorListener from '../../../listeners/commands/commandError.js'; import { Format } from '../../common/Format.js'; -const { default: humanizeDuration } = await import ('humanize-duration') export class BushClientUtil extends ClientUtil { /** @@ -255,11 +255,11 @@ export class BushClientUtil extends ClientUtil { * @param options - The options you would like to use to inspect the object */ public inspect(object: any, options?: BushInspectOptions): string { - const optionsWithDefaults = this.getDefaultInspectOptions(options) + const optionsWithDefaults = this.getDefaultInspectOptions(options); return inspect(object, optionsWithDefaults); } - private getDefaultInspectOptions(options?:BushInspectOptions): BushInspectOptions { + private getDefaultInspectOptions(options?: BushInspectOptions): BushInspectOptions { const { showHidden = false, depth = 2, @@ -274,18 +274,18 @@ export class BushClientUtil extends ClientUtil { getters = true } = options ?? {}; return { - showHidden, - depth, - colors, - customInspect, - showProxy, - maxArrayLength, - maxStringLength, - breakLength, - compact, - sorted, + showHidden, + depth, + colors, + customInspect, + showProxy, + maxArrayLength, + maxStringLength, + breakLength, + compact, + sorted, getters - } + }; } #mapCredential(old: string): string { @@ -331,9 +331,7 @@ export class BushClientUtil extends ClientUtil { length = 1024 ) { input = - !inspectOptions?.inspectStrings && typeof input === 'string' - ? input - : this.inspect(input, inspectOptions ?? undefined); + !inspectOptions?.inspectStrings && typeof input === 'string' ? input : this.inspect(input, inspectOptions ?? undefined); if (inspectOptions) inspectOptions.inspectStrings = undefined; input = this.discord.cleanCodeBlockContent(input); input = this.redact(input); @@ -449,8 +447,8 @@ export class BushClientUtil extends ClientUtil { } public humanizeDuration(duration: number, largest?: number): string { - if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest }); - else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 }); + if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest })!; + else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 })!; } public timestampDuration(duration: number): string { diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 03f6606..11f5ee3 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -1,10 +1,16 @@ import { type BushClient, type BushCommandHandler, type BushMessage, type BushSlashMessage } from '#lib'; -import { Command, type ArgumentOptions, type ArgumentPromptOptions, type ArgumentTypeCaster, type CommandOptions } from 'discord-akairo'; +import { + Command, + type ArgumentOptions, + type ArgumentPromptOptions, + type ArgumentTypeCaster, + type CommandOptions +} from 'discord-akairo'; import { BaseArgumentType } from 'discord-akairo/dist/src/struct/commands/arguments/Argument'; import { type PermissionResolvable, type Snowflake } from 'discord.js'; -export type BaseBushArgumentType = - | BaseArgumentType +export type BaseBushArgumentType = + | BaseArgumentType | 'duration' | 'contentWithDuration' | 'permission' -- cgit