aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-11-15 15:48:50 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-11-15 15:48:50 -0500
commite5f90ecfa84b2d102c0774b0c50a31d58025555b (patch)
treef3fa3da369089183537eae5da82fb9f2d4e19faf /src/lib/extensions
parent6fd7f7064782fddc20e65b5f1b1ba987c3a868a4 (diff)
downloadtanzanite-e5f90ecfa84b2d102c0774b0c50a31d58025555b.tar.gz
tanzanite-e5f90ecfa84b2d102c0774b0c50a31d58025555b.tar.bz2
tanzanite-e5f90ecfa84b2d102c0774b0c50a31d58025555b.zip
idk
Diffstat (limited to 'src/lib/extensions')
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts92
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts3
-rw-r--r--src/lib/extensions/discord.js/BushGuild.ts2
3 files changed, 36 insertions, 61 deletions
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<Ready extends boolean = boolean> extends AkairoClient<Re
public db: SequelizeType;
public logger = BushLogger;
public constants = BushConstants;
- public cache = BushCache;
+ public cache = new BushCache();
public sentry!: typeof Sentry;
public constructor(config: Config) {
@@ -279,15 +279,15 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
gateway: this.ws
});
this.commandHandler.resolver.addTypes({
- duration: durationTypeCaster,
- contentWithDuration: contentWithDurationTypeCaster,
- permission: permissionTypeCaster,
- snowflake: snowflakeTypeCaster,
- discordEmoji: discordEmojiTypeCaster,
- roleWithDuration: roleWithDurationTypeCaster,
- abbreviatedNumber: abbreviatedNumberTypeCaster,
- durationSeconds: durationSecondsTypeCaster,
- globalUser: globalUserTypeCaster
+ duration,
+ contentWithDuration,
+ permission,
+ snowflake,
+ discordEmoji,
+ roleWithDuration,
+ abbreviatedNumber,
+ durationSeconds,
+ globalUser
});
this.sentry = Sentry;
@@ -384,49 +384,25 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
}
public override isSuperUser(user: BushUserResolvable): boolean {
const userID = this.users.resolveId(user)!;
- return !!BushCache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID);
+ return !!client.cache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID);
}
- public override on<K extends keyof BushClientEvents>(
- event: K,
- listener: (...args: BushClientEvents[K]) => Awaitable<void>
- ): this;
- public override on<S extends string | symbol>(
- event: Exclude<S, keyof BushClientEvents>,
- listener: (...args: any[]) => Awaitable<void>
- ): this {
- return super.on(event as any, listener);
- }
- public override once<K extends keyof BushClientEvents>(
- event: K,
- listener: (...args: BushClientEvents[K]) => Awaitable<void>
- ): this;
- public override once<S extends string | symbol>(
- event: Exclude<S, keyof BushClientEvents>,
- listener: (...args: any[]) => Awaitable<void>
- ): this {
- return super.once(event as any, listener);
- }
+}
- public override emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean;
- public override emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean {
- return super.emit(event as any, ...args);
- }
+export interface BushClient {
+ on<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this;
+ on<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this
- public override off<K extends keyof BushClientEvents>(
- event: K,
- listener: (...args: BushClientEvents[K]) => Awaitable<void>
- ): this;
- public override off<S extends string | symbol>(
- event: Exclude<S, keyof BushClientEvents>,
- listener: (...args: any[]) => Awaitable<void>
- ): this {
- return super.off(event as any, listener);
- }
+ once<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this;
+ once<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this
- public override removeAllListeners<K extends keyof BushClientEvents>(event?: K): this;
- public override removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): this {
- return super.removeAllListeners(event as any);
- }
+ emit<K extends keyof BushClientEvents>(event: K, ...args: BushClientEvents[K]): boolean;
+ emit<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, ...args: unknown[]): boolean
+
+ off<K extends keyof BushClientEvents>(event: K, listener: (...args: BushClientEvents[K]) => Awaitable<void>): this;
+ off<S extends string | symbol>(event: Exclude<S, keyof BushClientEvents>, listener: (...args: any[]) => Awaitable<void>): this
+
+ removeAllListeners<K extends keyof BushClientEvents>(event?: K): this;
+ removeAllListeners<S extends string | symbol>(event?: Exclude<S, keyof BushClientEvents>): 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<Global | void> {
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;