From e5f90ecfa84b2d102c0774b0c50a31d58025555b Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Mon, 15 Nov 2021 15:48:50 -0500 Subject: idk --- src/lib/extensions/discord-akairo/BushClient.ts | 92 ++++++++-------------- .../extensions/discord-akairo/BushClientUtil.ts | 3 +- src/lib/extensions/discord.js/BushGuild.ts | 2 +- 3 files changed, 36 insertions(+), 61 deletions(-) (limited to 'src/lib/extensions') diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 39eff3b..93ed9d7 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -34,15 +34,15 @@ import path from 'path'; import readline from 'readline'; import type { Sequelize as SequelizeType } from 'sequelize'; import { fileURLToPath } from 'url'; -import { abbreviatedNumberTypeCaster } from '../../../arguments/abbreviatedNumber.js'; -import { contentWithDurationTypeCaster } from '../../../arguments/contentWithDuration.js'; -import { discordEmojiTypeCaster } from '../../../arguments/discordEmoji.js'; -import { durationTypeCaster } from '../../../arguments/duration.js'; -import { durationSecondsTypeCaster } from '../../../arguments/durationSeconds.js'; -import { globalUserTypeCaster } from '../../../arguments/globalUser.js'; -import { permissionTypeCaster } from '../../../arguments/permission.js'; -import { roleWithDurationTypeCaster } from '../../../arguments/roleWithDuration.js'; -import { snowflakeTypeCaster } from '../../../arguments/snowflake.js'; +import { abbreviatedNumber } from '../../../arguments/abbreviatedNumber.js'; +import { contentWithDuration } from '../../../arguments/contentWithDuration.js'; +import { discordEmoji } from '../../../arguments/discordEmoji.js'; +import { duration } from '../../../arguments/duration.js'; +import { durationSeconds } from '../../../arguments/durationSeconds.js'; +import { globalUser } from '../../../arguments/globalUser.js'; +import { permission } from '../../../arguments/permission.js'; +import { roleWithDuration } from '../../../arguments/roleWithDuration.js'; +import { snowflake } from '../../../arguments/snowflake.js'; import UpdateCacheTask from '../../../tasks/updateCache.js'; import UpdateStatsTask from '../../../tasks/updateStats.js'; import { ActivePunishment } from '../../models/ActivePunishment.js'; @@ -136,7 +136,7 @@ export class BushClient extends AkairoClient extends AkairoClient extends AkairoClient( - event: K, - listener: (...args: BushClientEvents[K]) => Awaitable - ): this; - public override on( - event: Exclude, - listener: (...args: any[]) => Awaitable - ): this { - return super.on(event as any, listener); - } - public override once( - event: K, - listener: (...args: BushClientEvents[K]) => Awaitable - ): this; - public override once( - event: Exclude, - listener: (...args: any[]) => Awaitable - ): this { - return super.once(event as any, listener); - } +} - public override emit(event: K, ...args: BushClientEvents[K]): boolean; - public override emit(event: Exclude, ...args: unknown[]): boolean { - return super.emit(event as any, ...args); - } +export interface BushClient { + on(event: K, listener: (...args: BushClientEvents[K]) => Awaitable): this; + on(event: Exclude, listener: (...args: any[]) => Awaitable): this - public override off( - event: K, - listener: (...args: BushClientEvents[K]) => Awaitable - ): this; - public override off( - event: Exclude, - listener: (...args: any[]) => Awaitable - ): this { - return super.off(event as any, listener); - } + once(event: K, listener: (...args: BushClientEvents[K]) => Awaitable): this; + once(event: Exclude, listener: (...args: any[]) => Awaitable): this - public override removeAllListeners(event?: K): this; - public override removeAllListeners(event?: Exclude): this { - return super.removeAllListeners(event as any); - } + emit(event: K, ...args: BushClientEvents[K]): boolean; + emit(event: Exclude, ...args: unknown[]): boolean + + off(event: K, listener: (...args: BushClientEvents[K]) => Awaitable): this; + off(event: Exclude, listener: (...args: any[]) => Awaitable): this + + removeAllListeners(event?: K): this; + removeAllListeners(event?: Exclude): this } diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index f619b4b..4b68b2e 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -2,7 +2,6 @@ import { Arg, BushConstants, Global, - type BushCache, type BushClient, type BushInspectOptions, type BushMessage, @@ -388,7 +387,7 @@ export class BushClientUtil extends ClientUtil { public async insertOrRemoveFromGlobal( action: 'add' | 'remove', - key: keyof typeof BushCache['global'], + key: keyof typeof client['cache']['global'], value: any ): Promise { const row = diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index dd01c55..5849749 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -191,7 +191,7 @@ export class BushGuild extends Guild { const userObject = client.users.cache.get(user.id); const dmSuccess = await userObject - ?.send(`You have been unbanned from **${this}** for **${options.reason ?? 'No reason provided'}**.`) + ?.send(`You have been unbanned from **${util.discord.escapeMarkdown(this.toString())}** for **${options.reason ?? 'No reason provided'}**.`) .catch(() => false); dmSuccessEvent = !!dmSuccess; -- cgit