aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/launch.json21
-rw-r--r--package.json29
-rw-r--r--src/arguments/abbreviatedNumber.ts2
-rw-r--r--src/arguments/contentWithDuration.ts2
-rw-r--r--src/arguments/discordEmoji.ts2
-rw-r--r--src/arguments/duration.ts2
-rw-r--r--src/arguments/durationSeconds.ts2
-rw-r--r--src/arguments/globalUser.ts2
-rw-r--r--src/arguments/permission.ts2
-rw-r--r--src/arguments/roleWithDuration.ts2
-rw-r--r--src/arguments/snowflake.ts2
-rw-r--r--src/commands/config/config.ts1
-rw-r--r--src/commands/config/features.ts27
-rw-r--r--src/commands/utilities/uuid.ts2
-rw-r--r--src/commands/utilities/wolframAlpha.ts2
-rw-r--r--src/lib/common/typings/BushInspectOptions.d.ts10
-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
-rw-r--r--src/lib/utils/BushCache.ts18
-rw-r--r--tsconfig.json3
-rw-r--r--yarn.lock604
22 files changed, 317 insertions, 515 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 16a966e..3237d6d 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -2,27 +2,22 @@
"configurations": [
{
"command": "yarn dev",
- "name": "BushBot (tsc)",
+ "name": "BushBot",
"request": "launch",
- "type": "node-terminal",
- "skipFiles": ["<node_internals>/**",
+ "type": "pwa-node",
+ "skipFiles": [
+ "<node_internals>/**",
// "**/Yarn/**",
- "**/.pnp.js", "**/.yarn/releases/**"],
+ "**/.pnp.js",
+ "**/.yarn/releases/**"
+ ],
"outFiles": [
"${workspaceRoot}/dist/**/*.js",
- "${workspaceRoot}/.yarn/unplugged/**/node_modules/discord-akairo/lib/**/.js)"
],
"sourceMaps": true,
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
]
- },
- {
- "command": "yarn start",
- "name": "BushBot (esbuild)",
- "request": "launch",
- "type": "node-terminal",
- "skipFiles": ["<node_internals>/**", "**/Yarn/**", "**/.pnp.js", "**/.yarn/releases/**"]
}
]
-}
+} \ No newline at end of file
diff --git a/package.json b/package.json
index ba1b852..4f2627e 100644
--- a/package.json
+++ b/package.json
@@ -34,15 +34,17 @@
"format": "yarn prettier . --write",
"lint": "yarn eslint --ext js,jsx,ts,tsx src",
"format:check": "yarn prettier . --check",
- "upgrade": "yarn rimraf yarn.lock && yarn cache clean && yarn install && yarn up || true || yarn dlx @yarnpkg/sdks vscode",
+ "upgrade": "yarn rimraf yarn.lock && yarn cache clean && yarn install && yarn up && yarn up -R",
+ "upgrade:sdk": "yarn dlx @yarnpkg/sdks vscode",
"beta": "git push && git checkout beta && git merge master && git push && git checkout master",
"deploy:beta": "wsl /bin/bash -c \"pm2 deploy ecosystem.config.cjs beta\"",
"deploy:production": "wsl /bin/bash -c \"pm2 deploy ecosystem.config.cjs production\"",
"deploy:all": "yarn beta && wsl /bin/bash -c \"pm2 deploy ecosystem.config.cjs production && pm2 deploy ecosystem.config.cjs beta\""
},
"dependencies": {
- "@sentry/node": "^6.14.1",
- "@sentry/tracing": "^6.14.1",
+ "@notenoughupdates/wolfram-alpha-api": "^1.0.0",
+ "@sentry/node": "^6.14.3",
+ "@sentry/tracing": "^6.14.3",
"canvas": "^2.8.0",
"chalk": "^4.1.2",
"discord-akairo": "npm:@notenoughupdates/discord-akairo@dev",
@@ -53,9 +55,9 @@
"got": "^11.8.2",
"humanize-duration": "^3.27.0",
"lodash": "^4.17.21",
- "mathjs": "^9.5.0",
+ "mathjs": "^10.0.0",
"moment": "^2.29.1",
- "nanoid": "^3.1.28",
+ "nanoid": "^3.1.30",
"node-os-utils": "^1.3.5",
"numeral": "^2.0.6",
"pg": "^8.7.1",
@@ -63,27 +65,26 @@
"prettier": "^2.4.1",
"pretty-bytes": "^5.6.0",
"rimraf": "^3.0.2",
- "sequelize": "^6.6.5",
+ "sequelize": "^6.9.0",
"simplify-number": "^1.0.0",
"source-map-support": "^0.5.20",
"tinycolor2": "^1.4.2",
"tslib": "^2.3.1",
- "typescript": "rc",
- "wolfram-alpha-api": "npm:@notenoughupdates/wolfram-alpha-api@latest"
+ "typescript": "rc"
},
"devDependencies": {
"@types/express": "^4.17.13",
- "@types/humanize-duration": "^3.25.1",
+ "@types/humanize-duration": "^3.27.0",
"@types/lodash": "^4.14.176",
- "@types/node": "^16.11.6",
+ "@types/node": "^16.11.7",
"@types/node-os-utils": "^1.2.0",
"@types/numeral": "^2.0.2",
"@types/tinycolor2": "^1.4.3",
- "@types/validator": "^13.6.3",
- "@typescript-eslint/eslint-plugin": "^5.2.0",
- "@typescript-eslint/parser": "^5.2.0",
+ "@types/validator": "^13.6.6",
+ "@typescript-eslint/eslint-plugin": "^5.3.1",
+ "@typescript-eslint/parser": "^5.3.1",
"discord-api-types": "0.24.0",
- "eslint": "^7.32.0",
+ "eslint": "^8.2.0",
"eslint-config-prettier": "^8.3.0"
},
"eslintConfig": {
diff --git a/src/arguments/abbreviatedNumber.ts b/src/arguments/abbreviatedNumber.ts
index 4dae2ff..3a447d7 100644
--- a/src/arguments/abbreviatedNumber.ts
+++ b/src/arguments/abbreviatedNumber.ts
@@ -1,7 +1,7 @@
import { type BushArgumentTypeCaster } from '#lib';
import numeral from 'numeral';
-export const abbreviatedNumberTypeCaster: BushArgumentTypeCaster = (_, phrase): number | null => {
+export const abbreviatedNumber: BushArgumentTypeCaster = (_, phrase): number | null => {
if (!phrase) return null;
const num = numeral(phrase?.toLowerCase()).value();
diff --git a/src/arguments/contentWithDuration.ts b/src/arguments/contentWithDuration.ts
index 9bebaef..a9a7c23 100644
--- a/src/arguments/contentWithDuration.ts
+++ b/src/arguments/contentWithDuration.ts
@@ -1,6 +1,6 @@
import { type BushArgumentTypeCaster } from '#lib';
-export const contentWithDurationTypeCaster: BushArgumentTypeCaster = async (
+export const contentWithDuration: BushArgumentTypeCaster = async (
_,
phrase
): Promise<{ duration: number | null; contentWithoutTime: string | null }> => {
diff --git a/src/arguments/discordEmoji.ts b/src/arguments/discordEmoji.ts
index 6fb971a..8648f7f 100644
--- a/src/arguments/discordEmoji.ts
+++ b/src/arguments/discordEmoji.ts
@@ -1,7 +1,7 @@
import { type BushArgumentTypeCaster } from '#lib';
import { type Snowflake } from 'discord-api-types';
-export const discordEmojiTypeCaster: BushArgumentTypeCaster = (_, phrase): { name: string; id: Snowflake } | null => {
+export const discordEmoji: BushArgumentTypeCaster = (_, phrase): { name: string; id: Snowflake } | null => {
if (!phrase) return null;
const validEmoji: RegExpExecArray | null = client.consts.regex.discordEmoji.exec(phrase);
if (!validEmoji || !validEmoji.groups) return null;
diff --git a/src/arguments/duration.ts b/src/arguments/duration.ts
index e369ddd..9cb1d03 100644
--- a/src/arguments/duration.ts
+++ b/src/arguments/duration.ts
@@ -1,5 +1,5 @@
import { type BushArgumentTypeCaster } from '#lib';
-export const durationTypeCaster: BushArgumentTypeCaster = (_, phrase): number | null => {
+export const duration: BushArgumentTypeCaster = (_, phrase): number | null => {
return client.util.parseDuration(phrase).duration;
};
diff --git a/src/arguments/durationSeconds.ts b/src/arguments/durationSeconds.ts
index 78be1ce..8cbfa21 100644
--- a/src/arguments/durationSeconds.ts
+++ b/src/arguments/durationSeconds.ts
@@ -1,6 +1,6 @@
import { type BushArgumentTypeCaster } from '#lib';
-export const durationSecondsTypeCaster: BushArgumentTypeCaster = (_, phrase): number | null => {
+export const durationSeconds: BushArgumentTypeCaster = (_, phrase): number | null => {
phrase += 's';
return client.util.parseDuration(phrase).duration;
};
diff --git a/src/arguments/globalUser.ts b/src/arguments/globalUser.ts
index 344fe78..081eabf 100644
--- a/src/arguments/globalUser.ts
+++ b/src/arguments/globalUser.ts
@@ -1,7 +1,7 @@
import { BushUser, type BushArgumentTypeCaster } from '#lib';
// resolve non-cached users
-export const globalUserTypeCaster: BushArgumentTypeCaster = async (_, phrase): Promise<BushUser | null> => {
+export const globalUser: BushArgumentTypeCaster = async (_, phrase): Promise<BushUser | null> => {
return client.users.cache.has(phrase)
? client.users.cache.get(`${phrase}`) ?? null
: await client.users.fetch(`${phrase}`).catch(() => null);
diff --git a/src/arguments/permission.ts b/src/arguments/permission.ts
index 4f335dc..36c8fcb 100644
--- a/src/arguments/permission.ts
+++ b/src/arguments/permission.ts
@@ -1,7 +1,7 @@
import { type BushArgumentTypeCaster } from '#lib';
import { Permissions } from 'discord.js';
-export const permissionTypeCaster: BushArgumentTypeCaster = (_, phrase) => {
+export const permission: BushArgumentTypeCaster = (_, phrase) => {
if (!phrase) return null;
phrase = phrase.toUpperCase().replace(/ /g, '_');
if (!Reflect.has(Permissions.FLAGS, phrase)) {
diff --git a/src/arguments/roleWithDuration.ts b/src/arguments/roleWithDuration.ts
index 455ad76..9bf4bb2 100644
--- a/src/arguments/roleWithDuration.ts
+++ b/src/arguments/roleWithDuration.ts
@@ -1,6 +1,6 @@
import { type BushArgumentTypeCaster } from '#lib';
-export const roleWithDurationTypeCaster: BushArgumentTypeCaster = async (
+export const roleWithDuration: BushArgumentTypeCaster = async (
message,
phrase
): Promise<{ duration: number | null; role: string | null } | null> => {
diff --git a/src/arguments/snowflake.ts b/src/arguments/snowflake.ts
index 03d78c2..455ed63 100644
--- a/src/arguments/snowflake.ts
+++ b/src/arguments/snowflake.ts
@@ -1,7 +1,7 @@
import { type BushArgumentTypeCaster } from '#lib';
import { type Snowflake } from 'discord.js';
-export const snowflakeTypeCaster: BushArgumentTypeCaster = (_, phrase): Snowflake | null => {
+export const snowflake: BushArgumentTypeCaster = (_, phrase): Snowflake | null => {
if (!phrase) return null;
if (client.consts.regex.snowflake.test(phrase)) return phrase;
return null;
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 7811663..00c6a69 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -101,7 +101,6 @@ export default class SettingsCommand extends BushCommand {
});
}
- // I make very readable code :)
override *args(message: BushMessage): Generator<ArgumentOptions | Flag> {
const optional = message.util.parsed!.alias === 'settings';
const setting = yield {
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index 7f9ffc9..8c9351d 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -74,21 +74,20 @@ export default class FeaturesCommand extends BushCommand {
);
}
- public generateComponents(guildFeatures: GuildFeatures[], disable: boolean): MessageActionRow {
+ public generateComponents(guildFeatures: GuildFeatures[], disable: boolean) {
return new MessageActionRow().addComponents(
- new MessageSelectMenu()
- .addOptions(
- ...guildFeatures.map((f) => ({
- label: guildFeaturesObj[f].name,
- value: f,
- description: guildFeaturesObj[f].description
- }))
- )
- .setPlaceholder('Select A Feature to Toggle')
- .setMaxValues(1)
- .setMinValues(1)
- .setCustomId('command_selectFeature')
- .setDisabled(disable)
+ new MessageSelectMenu({
+ customId: 'command_selectFeature',
+ disabled: disable,
+ maxValues: 1,
+ minValues: 2,
+ options: guildFeatures.map((f) => ({
+ label: guildFeaturesObj[f].name,
+ value: f,
+ description: guildFeaturesObj[f].description
+ })),
+ placeholder: 'Select A Feature to Toggle'
+ })
);
}
}
diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts
index 556a4de..1be6079 100644
--- a/src/commands/utilities/uuid.ts
+++ b/src/commands/utilities/uuid.ts
@@ -2,7 +2,7 @@ import { BushCommand, type BushMessage } from '#lib';
export default class UuidCommand extends BushCommand {
public constructor() {
- super('uuid', {
+ super('uuid', {
aliases: ['uuid'],
category: 'utilities',
description: {
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts
index aba0f57..13512bb 100644
--- a/src/commands/utilities/wolframAlpha.ts
+++ b/src/commands/utilities/wolframAlpha.ts
@@ -1,6 +1,6 @@
import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { MessageEmbed, type MessageOptions } from 'discord.js';
-const {default: WolframAlphaAPI} = (await import("wolfram-alpha-api")).default as unknown as typeof import( "wolfram-alpha-api")
+const { default: WolframAlphaAPI } = (await import("@notenoughupdates/wolfram-alpha-api")).default as unknown as typeof import("@notenoughupdates/wolfram-alpha-api")
export default class WolframAlphaCommand extends BushCommand {
public constructor() {
diff --git a/src/lib/common/typings/BushInspectOptions.d.ts b/src/lib/common/typings/BushInspectOptions.d.ts
index 11c2dc1..e51e758 100644
--- a/src/lib/common/typings/BushInspectOptions.d.ts
+++ b/src/lib/common/typings/BushInspectOptions.d.ts
@@ -12,6 +12,7 @@ export interface BushInspectOptions extends InspectOptions {
* **Default**: `false`.
*/
showHidden?: boolean | undefined;
+
/**
* Specifies the number of times to recurse while formatting `object`. This is useful
* for inspecting large objects. To recurse up to the maximum call stack size pass
@@ -20,24 +21,28 @@ export interface BushInspectOptions extends InspectOptions {
* **Default**: `2`.
*/
depth?: number | null | undefined;
+
/**
* If `true`, the output is styled with ANSI color codes. Colors are customizable. See [Customizing util.inspect colors](https://nodejs.org/api/util.html#util_customizing_util_inspect_colors).
*
* **Default**: `false`.
*/
colors?: boolean | undefined;
+
/**
* If `false`, `[util.inspect.custom](depth, opts)` functions are not invoked.
*
* **Default**: `true`.
*/
customInspect?: boolean | undefined;
+
/**
* If `true`, `Proxy` inspection includes the [`target` and `handler`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#Terminology) objects.
*
* **Default**: `false`.
*/
showProxy?: boolean | undefined;
+
/**
* Specifies the maximum number of `Array`, [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and
* [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) elements to include when formatting. Set to `null` or `Infinity` to
@@ -46,6 +51,7 @@ export interface BushInspectOptions extends InspectOptions {
* **Default**: `100`.
*/
maxArrayLength?: number | null | undefined;
+
/**
* Specifies the maximum number of characters to include when formatting. Set to
* `null` or `Infinity` to show all elements. Set to `0` or negative to show no
@@ -54,6 +60,7 @@ export interface BushInspectOptions extends InspectOptions {
* **Default**: `10000`.
*/
maxStringLength?: number | null | undefined;
+
/**
* The length at which input values are split across multiple lines. Set to
* `Infinity` to format the input as a single line (in combination with compact set
@@ -62,6 +69,7 @@ export interface BushInspectOptions extends InspectOptions {
* **Default**: `80`.
*/
breakLength?: number | undefined;
+
/**
* Setting this to `false` causes each object key to be displayed on a new line. It
* will break on new lines in text that is longer than `breakLength`. If set to a
@@ -71,6 +79,7 @@ export interface BushInspectOptions extends InspectOptions {
* **Default**: `3`
*/
compact?: boolean | number | undefined;
+
/**
* If set to `true` or a function, all properties of an object, and `Set` and `Map`
* entries are sorted in the resulting string. If set to `true` the [default sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) is used.
@@ -79,6 +88,7 @@ export interface BushInspectOptions extends InspectOptions {
* **Default**: `false`.
*/
sorted?: boolean | ((a: string, b: string) => number) | undefined;
+
/**
* If set to `true`, getters are inspected. If set to `'get'`, only getters without a
* corresponding setter are inspected. If set to `'set'`, only getters with a
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;
diff --git a/src/lib/utils/BushCache.ts b/src/lib/utils/BushCache.ts
index d633898..3808538 100644
--- a/src/lib/utils/BushCache.ts
+++ b/src/lib/utils/BushCache.ts
@@ -2,12 +2,14 @@ import { Collection, type Snowflake } from 'discord.js';
import { Guild } from '../models/Guild.js';
export class BushCache {
- public static global = {
- superUsers: new Array<Snowflake>(),
- disabledCommands: new Array<string>(),
- blacklistedChannels: new Array<Snowflake>(),
- blacklistedGuilds: new Array<Snowflake>(),
- blacklistedUsers: new Array<Snowflake>()
- };
- public static guilds = new Collection<Snowflake, Guild>();
+ public global = new GlobalCache();
+ public guilds = new Collection<Snowflake, Guild>();
+}
+
+export class GlobalCache {
+ public superUsers: Snowflake[] = [];
+ public disabledCommands: string[] = []
+ public blacklistedChannels: Snowflake[] = [];
+ public blacklistedGuilds: Snowflake[] = [];
+ public blacklistedUsers: Snowflake[] = [];
}
diff --git a/tsconfig.json b/tsconfig.json
index a5025c0..136ef4a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -6,8 +6,6 @@
"outDir": "dist",
"lib": ["esnext", "esnext.array", "esnext.asyncIterable", "esnext.intl", "esnext.symbol"],
"sourceMap": true,
- // "inlineSourceMap": true,
- // "inlineSources": true,
"incremental": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
@@ -21,7 +19,6 @@
"noEmitHelpers": true,
"importHelpers": true,
"allowSyntheticDefaultImports": true,
- // "importsNotUsedAsValues": "error",
"preserveValueImports": true,
"removeComments": true,
"paths": {
diff --git a/yarn.lock b/yarn.lock
index 7b2353f..ec70510 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5,39 +5,12 @@ __metadata:
version: 5
cacheKey: 8
-"@babel/code-frame@npm:7.12.11":
- version: 7.12.11
- resolution: "@babel/code-frame@npm:7.12.11"
- dependencies:
- "@babel/highlight": ^7.10.4
- checksum: 3963eff3ebfb0e091c7e6f99596ef4b258683e4ba8a134e4e95f77afe85be5c931e184fff6435fb4885d12eba04a5e25532f7fbc292ca13b48e7da943474e2f3
- languageName: node
- linkType: hard
-
-"@babel/helper-validator-identifier@npm:^7.15.7":
- version: 7.15.7
- resolution: "@babel/helper-validator-identifier@npm:7.15.7"
- checksum: f041c28c531d1add5cc345b25d5df3c29c62bce3205b4d4a93dcd164ccf630350acba252d374fad8f5d8ea526995a215829f27183ba7ce7ce141843bf23068a6
- languageName: node
- linkType: hard
-
-"@babel/highlight@npm:^7.10.4":
- version: 7.16.0
- resolution: "@babel/highlight@npm:7.16.0"
- dependencies:
- "@babel/helper-validator-identifier": ^7.15.7
- chalk: ^2.0.0
- js-tokens: ^4.0.0
- checksum: abf244c48fcff20ec87830e8b99c776f4dcdd9138e63decc195719a94148da35339639e0d8045eb9d1f3e67a39ab90a9c3f5ce2d579fb1a0368d911ddf29b4e5
- languageName: node
- linkType: hard
-
-"@babel/runtime@npm:^7.15.4":
- version: 7.16.0
- resolution: "@babel/runtime@npm:7.16.0"
+"@babel/runtime@npm:^7.16.0":
+ version: 7.16.3
+ resolution: "@babel/runtime@npm:7.16.3"
dependencies:
regenerator-runtime: ^0.13.4
- checksum: bfbca3ec52c94de262a3932473bceeead1a088b50194108fa1ff6eda447333f0f7d43fa4e9c5937c6e5d45bf838da8480905d0a227589b257c51f954ea060bac
+ checksum: ab8ac887096d76185ddbf291d28fb976cd32473696dc497ad4905b784acbd5aa462533ad83a5c5104e10ead28c2e0e119840ee28ed8eff90dcdde9d57f916eda
languageName: node
linkType: hard
@@ -72,20 +45,20 @@ __metadata:
languageName: node
linkType: hard
-"@eslint/eslintrc@npm:^0.4.3":
- version: 0.4.3
- resolution: "@eslint/eslintrc@npm:0.4.3"
+"@eslint/eslintrc@npm:^1.0.4":
+ version: 1.0.4
+ resolution: "@eslint/eslintrc@npm:1.0.4"
dependencies:
ajv: ^6.12.4
- debug: ^4.1.1
- espree: ^7.3.0
+ debug: ^4.3.2
+ espree: ^9.0.0
globals: ^13.9.0
ignore: ^4.0.6
import-fresh: ^3.2.1
- js-yaml: ^3.13.1
+ js-yaml: ^4.1.0
minimatch: ^3.0.4
strip-json-comments: ^3.1.1
- checksum: 03a7704150b868c318aab6a94d87a33d30dc2ec579d27374575014f06237ba1370ae11178db772f985ef680d469dc237e7b16a1c5d8edaaeb8c3733e7a95a6d3
+ checksum: 570f87e216944830b3761889f14cdf1e9bc7dcc2211e941585cfc2768575954e26852605eb441e21c9581472f89ea0e9cfdb8309523e9fe0a57fe9342bda4fe0
languageName: node
linkType: hard
@@ -96,14 +69,14 @@ __metadata:
languageName: node
linkType: hard
-"@humanwhocodes/config-array@npm:^0.5.0":
- version: 0.5.0
- resolution: "@humanwhocodes/config-array@npm:0.5.0"
+"@humanwhocodes/config-array@npm:^0.6.0":
+ version: 0.6.0
+ resolution: "@humanwhocodes/config-array@npm:0.6.0"
dependencies:
"@humanwhocodes/object-schema": ^1.2.0
debug: ^4.1.1
minimatch: ^3.0.4
- checksum: 44ee6a9f05d93dd9d5935a006b17572328ba9caff8002442f601736cbda79c580cc0f5a49ce9eb88fbacc5c3a6b62098357c2e95326cd17bb9f1a6c61d6e95e7
+ checksum: 1025b07514b7bfd10a05e8b6cb5e6520878e9c8836b3dd0569fc07df29a09e428c2df1e0760b1d461da8ed6f81ca83ecb02e24198f80b0a177a2acbf532e267c
languageName: node
linkType: hard
@@ -160,6 +133,13 @@ __metadata:
languageName: node
linkType: hard
+"@notenoughupdates/wolfram-alpha-api@npm:^1.0.0":
+ version: 1.0.1
+ resolution: "@notenoughupdates/wolfram-alpha-api@npm:1.0.1"
+ checksum: 06a3db6054da8bfd3877cd18bd10bd4b332891d298c80545029a8476cdfaecf9b42f775b8cf6b60e723210585612e34d4b910a0beac7dd9cc8c013b85550cd98
+ languageName: node
+ linkType: hard
+
"@npmcli/fs@npm:^1.0.0":
version: 1.0.0
resolution: "@npmcli/fs@npm:1.0.0"
@@ -187,85 +167,85 @@ __metadata:
languageName: node
linkType: hard
-"@sentry/core@npm:6.14.1":
- version: 6.14.1
- resolution: "@sentry/core@npm:6.14.1"
+"@sentry/core@npm:6.14.3":
+ version: 6.14.3
+ resolution: "@sentry/core@npm:6.14.3"
dependencies:
- "@sentry/hub": 6.14.1
- "@sentry/minimal": 6.14.1
- "@sentry/types": 6.14.1
- "@sentry/utils": 6.14.1
+ "@sentry/hub": 6.14.3
+ "@sentry/minimal": 6.14.3
+ "@sentry/types": 6.14.3
+ "@sentry/utils": 6.14.3
tslib: ^1.9.3
- checksum: 858f54b39fce1c4048b91ec4bf004bda1fcd8405d75399da5e2986688fade036f7fb17e02ecf545fa7a3e9b45dd37edc9809e6d10b32e16c3d0a9aa2efe0ff13
+ checksum: f3edb42055a6baf6accfc0e44c8a4811f727d184a85d63f57da2aac3b5bbe43898590be6a2a2ecb2bfb68ea02c26f007ca3aa4d13afd4b0548064aa4065626b3
languageName: node
linkType: hard
-"@sentry/hub@npm:6.14.1":
- version: 6.14.1
- resolution: "@sentry/hub@npm:6.14.1"
+"@sentry/hub@npm:6.14.3":
+ version: 6.14.3
+ resolution: "@sentry/hub@npm:6.14.3"
dependencies:
- "@sentry/types": 6.14.1
- "@sentry/utils": 6.14.1
+ "@sentry/types": 6.14.3
+ "@sentry/utils": 6.14.3