aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/launch.json12
-rw-r--r--.vscode/settings.json3
-rw-r--r--package.json6
-rw-r--r--src/bot.ts1
-rw-r--r--src/commands/config/blacklist.ts1
-rw-r--r--src/commands/config/settings.ts59
-rw-r--r--src/commands/info/color.ts13
-rw-r--r--src/commands/utilities/viewraw.ts1
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts463
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts18
-rw-r--r--src/lib/extensions/discord-akairo/BushCommandHandler.ts4
-rw-r--r--yarn.lock17
12 files changed, 560 insertions, 38 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index c6666c9..16a966e 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -5,7 +5,17 @@
"name": "BushBot (tsc)",
"request": "launch",
"type": "node-terminal",
- "skipFiles": ["<node_internals>/**", "**/Yarn/**", "**/.pnp.js", "**/.yarn/releases/**"]
+ "skipFiles": ["<node_internals>/**",
+ // "**/Yarn/**",
+ "**/.pnp.js", "**/.yarn/releases/**"],
+ "outFiles": [
+ "${workspaceRoot}/dist/**/*.js",
+ "${workspaceRoot}/.yarn/unplugged/**/node_modules/discord-akairo/lib/**/.js)"
+ ],
+ "sourceMaps": true,
+ "resolveSourceMapLocations": [
+ "${workspaceFolder}/**",
+ ]
},
{
"command": "yarn start",
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 76966c1..1a348f1 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -89,5 +89,6 @@
"bold": false,
"italic": false
}
- ]
+ ],
+ "compile-hero.disable-compile-files-on-did-save-code": true
}
diff --git a/package.json b/package.json
index eb85a38..413889d 100644
--- a/package.json
+++ b/package.json
@@ -20,9 +20,9 @@
"scripts": {
"build-esbuild": "yarn rimraf dist && yarn esbuild --sourcemap=inline --outdir=dist --platform=node --target=es2020 --format=cjs --log-level=warning src/**/*.ts",
"build-tsc": "yarn rimraf dist && yarn tsc",
- "_start": "yarn build-esbuild && node --trace-warnings -r source-map-support/register dist/src/bot.js",
- "start": "yarn build-tsc && node --trace-warnings -r source-map-support/register dist/src/bot.js",
- "dev": "yarn build-tsc && node --trace-warnings -r source-map-support/register dist/src/bot.js",
+ "_start": "yarn build-esbuild && node --trace-warnings dist/src/bot.js",
+ "start": "yarn build-tsc && node --trace-warnings dist/src/bot.js",
+ "dev": "yarn build-tsc && node --trace-warnings dist/src/bot.js",
"test": "yarn lint && yarn tsc --noEmit",
"format": "yarn prettier . --write",
"lint": "yarn eslint --ext js,jsx,ts,tsx src",
diff --git a/src/bot.ts b/src/bot.ts
index 4edab6e..a04a4fc 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -1,4 +1,5 @@
import 'module-alias/register';
+import 'source-map-support/register';
import config from './config/options';
import { BushClient } from './lib/';
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index 78b0446..864081c 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -16,7 +16,6 @@ export default class BlacklistCommand extends BushCommand {
{
id: 'target',
customType: Argument.union('channel', 'user'),
-
prompt: {
start: 'What channel or user that you would like to blacklist/unblacklist?',
retry: '{error} Pick a valid command.',
diff --git a/src/commands/config/settings.ts b/src/commands/config/settings.ts
new file mode 100644
index 0000000..f474804
--- /dev/null
+++ b/src/commands/config/settings.ts
@@ -0,0 +1,59 @@
+// import { BushCommand, BushMessage, BushSlashMessage } from '@lib';
+
+// export default class SettingsCommand extends BushCommand {
+// public constructor() {
+// super('settings', {
+// aliases: ['settings'],
+// category: 'config',
+// description: {
+// content: 'Configure options for ',
+// usage: 'template <requiredArg> [optionalArg]',
+// examples: ['template 1 2']
+// },
+// args: [
+// {
+// id: 'required_argument',
+// type: 'string',
+// prompt: {
+// start: 'What would you like to set your first argument to be?',
+// retry: '{error} Pick a valid argument.',
+// optional: false
+// }
+// },
+// {
+// id: 'optional_argument',
+// type: 'string',
+// prompt: {
+// start: 'What would you like to set your second argument to be?',
+// retry: '{error} Pick a valid argument.',
+// optional: true
+// }
+// }
+// ],
+// slash: false, //set this to true
+// slashOptions: [
+// {
+// name: 'required_argument',
+// description: 'What would you like to set your first argument to be?',
+// type: 'STRING',
+// required: true
+// },
+// {
+// name: 'optional_argument',
+// description: 'What would you like to set your second argument to be?',
+// type: 'STRING',
+// required: false
+// }
+// ],
+// superUserOnly: true,
+// ownerOnly: true,
+// channel: 'guild',
+// hidden: true,
+// clientPermissions: ['SEND_MESSAGES'],
+// userPermissions: ['SEND_MESSAGES']
+// });
+// }
+// public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> {
+// return await message.util.reply(`${util.emojis.error} Do not use the template command.`);
+// }
+// }
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
index 7ceb37f..93dd439 100644
--- a/src/commands/info/color.ts
+++ b/src/commands/info/color.ts
@@ -1,6 +1,6 @@
-import { BushCommand, BushGuildMember, BushMessage, BushRole, BushSlashMessage } from '@lib';
+import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushRole, BushSlashMessage } from '@lib';
import { Argument } from 'discord-akairo';
-import { ColorResolvable, MessageEmbed, Role } from 'discord.js';
+import { MessageEmbed, Role } from 'discord.js';
import { Constructor } from 'tinycolor2';
// eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -51,12 +51,19 @@ export default class ColorCommand extends BushCommand {
? tinycolor(args.color.hexColor)
: tinycolor(args.color.displayHexColor);
+ if (args.color instanceof Role && args.color.hexColor === '#000000') {
+ return await message.util.reply({
+ content: `${util.emojis.error} <@&${args.color.id}> does not have a color.`,
+ allowedMentions: AllowedMentions.none()
+ });
+ }
+
const embed = new MessageEmbed()
.addField('» Hexadecimal', color.toHexString())
.addField('» Decimal', `${parseInt(color.toHex(), 16)}`)
.addField('» HSL', this.removePrefixAndParenthesis(color.toHslString()))
.addField('» RGB', this.removePrefixAndParenthesis(color.toRgbString()))
- .setColor(color.toHex() as ColorResolvable);
+ .setColor(color.toHex() as `#${string}`);
return await message.util.reply({ embeds: [embed] });
}
diff --git a/src/commands/utilities/viewraw.ts b/src/commands/utilities/viewraw.ts
index 46353ba..0a5f9e2 100644
--- a/src/commands/utilities/viewraw.ts
+++ b/src/commands/utilities/viewraw.ts
@@ -17,7 +17,6 @@ export default class ViewRawCommand extends BushCommand {
{
id: 'message',
customType: util.arg.union('message', 'bigint'),
-
prompt: {
start: 'What message would you like to view?',
retry: '{error} Choose a valid message.',
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 3ee63a7..2a01f6a 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -97,6 +97,407 @@ interface MojangProfile {
uuid: string;
}
+export type CodeBlockLang =
+ | '1c'
+ | 'abnf'
+ | 'accesslog'
+ | 'actionscript'
+ | 'ada'
+ | 'arduino'
+ | 'ino'
+ | 'armasm'
+ | 'arm'
+ | 'avrasm'
+ | 'actionscript'
+ | 'as'
+ | 'angelscript'
+ | 'asc'
+ | 'apache'
+ | 'apacheconf'
+ | 'applescript'
+ | 'osascript'
+ | 'arcade'
+ | 'asciidoc'
+ | 'adoc'
+ | 'aspectj'
+ | 'autohotkey'
+ | 'autoit'
+ | 'awk'
+ | 'mawk'
+ | 'nawk'
+ | 'gawk'
+ | 'bash'
+ | 'sh'
+ | 'zsh'
+ | 'basic'
+ | 'bnf'
+ | 'brainfuck'
+ | 'bf'
+ | 'csharp'
+ | 'cs'
+ | 'c'
+ | 'h'
+ | 'cpp'
+ | 'hpp'
+ | 'cc'
+ | 'hh'
+ | 'c++'
+ | 'h++'
+ | 'cxx'
+ | 'hxx'
+ | 'cal'
+ | 'cos'
+ | 'cls'
+ | 'cmake'
+ | 'cmake.in'
+ | 'coq'
+ | 'csp'
+ | 'css'
+ | 'capnproto'
+ | 'capnp'
+ | 'clojure'
+ | 'clj'
+ | 'coffeescript'
+ | 'coffee'
+ | 'cson'
+ | 'iced'
+ | 'crmsh'
+ | 'crm'
+ | 'pcmk'
+ | 'crystal'
+ | 'cr'
+ | 'd'
+ | 'dns'
+ | 'zone'
+ | 'bind'
+ | 'dos'
+ | 'bat'
+ | 'cmd'
+ | 'dart'
+ | 'dpr'
+ | 'dfm'
+ | 'pas'
+ | 'pascal'
+ | 'diff'
+ | 'patch'
+ | 'django'
+ | 'jinja'
+ | 'dockerfile'
+ | 'docker'
+ | 'dsconfig'
+ | 'dts'
+ | 'dust'
+ | 'dst'
+ | 'ebnf'
+ | 'elixir'
+ | 'elm'
+ | 'erlang'
+ | 'erl'
+ | 'excel'
+ | 'xls'
+ | 'xlsx'
+ | 'fsharp'
+ | 'fs'
+ | 'fix'
+ | 'fortran'
+ | 'f90'
+ | 'f95'
+ | 'gcode'
+ | 'nc'
+ | 'gams'
+ | 'gms'
+ | 'gauss'
+ | 'gss'
+ | 'gherkin'
+ | 'go'
+ | 'golang'
+ | 'golo'
+ | 'gololang'
+ | 'gradle'
+ | 'groovy'
+ | 'xml'
+ | 'html'
+ | 'xhtml'
+ | 'rss'
+ | 'atom'
+ | 'xjb'
+ | 'xsd'
+ | 'xsl'
+ | 'plist'
+ | 'svg'
+ | 'http'
+ | 'https'
+ | 'haml'
+ | 'handlebars'
+ | 'hbs'
+ | 'html.hbs'
+ | 'html.handlebars'
+ | 'haskell'
+ | 'hs'
+ | 'haxe'
+ | 'hx'
+ | 'hlsl'
+ | 'hy'
+ | 'hylang'
+ | 'ini'
+ | 'toml'
+ | 'inform7'
+ | 'i7'
+ | 'irpf90'
+ | 'json'
+ | 'java'
+ | 'jsp'
+ | 'javascript'
+ | 'js'
+ | 'jsx'
+ | 'julia'
+ | 'julia-repl'
+ | 'kotlin'
+ | 'kt'
+ | 'tex'
+ | 'leaf'
+ | 'lasso'
+ | 'ls'
+ | 'lassoscript'
+ | 'less'
+ | 'ldif'
+ | 'lisp'
+ | 'livecodeserver'
+ | 'livescript'
+ | 'ls'
+ | 'lua'
+ | 'makefile'
+ | 'mk'
+ | 'mak'
+ | 'make'
+ | 'markdown'
+ | 'md'
+ | 'mkdown'
+ | 'mkd'
+ | 'mathematica'
+ | 'mma'
+ | 'wl'
+ | 'matlab'
+ | 'maxima'
+ | 'mel'
+ | 'mercury'
+ | 'mizar'
+ | 'mojolicious'
+ | 'monkey'
+ | 'moonscript'
+ | 'moon'
+ | 'n1ql'
+ | 'nsis'
+ | 'nginx'
+ | 'nginxconf'
+ | 'nim'
+ | 'nimrod'
+ | 'nix'
+ | 'ocaml'
+ | 'ml'
+ | 'objectivec'
+ | 'mm'
+ | 'objc'
+ | 'obj-c'
+ | 'obj-c++'
+ | 'objective-c++'
+ | 'glsl'
+ | 'openscad'
+ | 'scad'
+ | 'ruleslanguage'
+ | 'oxygene'
+ | 'pf'
+ | 'pf.conf'
+ | 'php'
+ | 'parser3'
+ | 'perl'
+ | 'pl'
+ | 'pm'
+ | 'plaintext'
+ | 'txt'
+ | 'text'
+ | 'pony'
+ | 'pgsql'
+ | 'postgres'
+ | 'postgresql'
+ | 'powershell'
+ | 'ps'
+ | 'ps1'
+ | 'processing'
+ | 'prolog'
+ | 'properties'
+ | 'protobuf'
+ | 'puppet'
+ | 'pp'
+ | 'python'
+ | 'py'
+ | 'gyp'
+ | 'profile'
+ | 'python-repl'
+ | 'pycon'
+ | 'k'
+ | 'kdb'
+ | 'qml'
+ | 'r'
+ | 'reasonml'
+ | 're'
+ | 'rib'
+ | 'rsl'
+ | 'graph'
+ | 'instances'
+ | 'ruby'
+ | 'rb'
+ | 'gemspec'
+ | 'podspec'
+ | 'thor'
+ | 'irb'
+ | 'rust'
+ | 'rs'
+ | 'sas'
+ | 'scss'
+ | 'sql'
+ | 'p21'
+ | 'step'
+ | 'stp'
+ | 'scala'
+ | 'scheme'
+ | 'scilab'
+ | 'sci'
+ | 'shell'
+ | 'console'
+ | 'smali'
+ | 'smalltalk'
+ | 'st'
+ | 'sml'
+ | 'ml'
+ | 'stan'
+ | 'stanfuncs'
+ | 'stata'
+ | 'stylus'
+ | 'styl'
+ | 'subunit'
+ | 'swift'
+ | 'tcl'
+ | 'tk'
+ | 'tap'
+ | 'thrift'
+ | 'tp'
+ | 'twig'
+ | 'craftcms'
+ | 'typescript'
+ | 'ts'
+ | 'vbnet'
+ | 'vb'
+ | 'vbscript'
+ | 'vbs'
+ | 'vhdl'
+ | 'vala'
+ | 'verilog'
+ | 'v'
+ | 'vim'
+ | 'axapta'
+ | 'x++'
+ | 'x86asm'
+ | 'xl'
+ | 'tao'
+ | 'xquery'
+ | 'xpath'
+ | 'xq'
+ | 'yml'
+ | 'yaml'
+ | 'zephir'
+ | 'zep';
+
+/**
+ * {@link https://nodejs.org/api/util.html#util_util_inspect_object_options}
+ */
+export interface BushInspectOptions extends InspectOptions {
+ /**
+ * If `true`, object's non-enumerable symbols and properties are included in the
+ * formatted result. [`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) entries are also included as well as
+ * user defined prototype properties (excluding method properties).
+ *
+ * **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
+ * `Infinity` or `null`.
+ *
+ * **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
+ * show all elements. Set to `0` or negative to show no elements.
+ *
+ * **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
+ * characters.
+ *
+ * **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
+ * to `true` or any number >= `1`).
+ *
+ * **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
+ * number, the most `n` inner elements are united on a single line as long as all
+ * properties fit into `breakLength`. Short array elements are also grouped together.
+ *
+ * **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.
+ * If set to a function, it is used as a [compare function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#parameters).
+ *
+ * **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
+ * corresponding setter are inspected. This might cause side effects depending on
+ * the getter function.
+ *
+ * **Default**: `false`.
+ */
+ getters?: 'get' | 'set' | boolean | undefined;
+}
+
export class BushClientUtil extends ClientUtil {
/** The client of this ClientUtil */
public declare readonly client: BushClient;
@@ -404,7 +805,9 @@ export class BushClientUtil extends ClientUtil {
}
}
- /** Sends a message with a button for the user to delete it. */
+ /**
+ * Sends a message with a button for the user to delete it.
+ */
public async sendWithDeleteButton(message: BushMessage | BushSlashMessage, options: MessageOptions): Promise<void> {
const paginateEmojis = this.#paginateEmojis;
updateOptions();
@@ -453,26 +856,29 @@ export class BushClientUtil extends ClientUtil {
* * Embed Description Limit = 4096 characters
* * Embed Field Limit = 1024 characters
*/
- public async codeblock(code: string, length: number, language?: 'ts' | 'js' | 'sh' | 'json' | ''): Promise<string> {
+ public async codeblock(code: string, length: number, language?: CodeBlockLang): Promise<string> {
let hasteOut = '';
const prefix = '```' + language + '\n';
const suffix = '\n```';
- language = language ?? '';
+ language = language ?? 'txt';
if (code.length + (prefix + suffix).length >= length)
hasteOut = 'Too large to display. Hastebin: ' + (await this.haste(code));
const FormattedHaste = hasteOut.length ? '\n' + hasteOut : '';
- const shortenedCode = hasteOut ? code.substring(0, length - (prefix + code + FormattedHaste + suffix).length) : code;
-
- const code3 = prefix + shortenedCode + suffix;
+ const shortenedCode = hasteOut ? code.substring(0, length - (prefix + FormattedHaste + suffix).length) : code;
+ const code3 = code.length ? prefix + shortenedCode + suffix + FormattedHaste : prefix + suffix;
if (code3.length > length) {
void client.console.warn(`codeblockError`, `Required Length: ${length}. Actual Length: ${code3.length}`, true);
void client.console.warn(`codeblockError`, code3, true);
- throw new Error('I fucked up');
+ throw new Error('code too long');
}
return code3;
}
+ public inspect(code: any, options: BushInspectOptions): string {
+ return inspect(code, options);
+ }
+
#mapCredential(old: string): string {
const mapping = {
['token']: 'Main Token',
@@ -500,8 +906,42 @@ export class BushClientUtil extends ClientUtil {
return text;
}
- public async inspectCleanRedactCodeblock(input: any, language: 'ts' | 'js', inspectOptions?: InspectOptions, length = 1024) {
- input = typeof input !== 'string' && inspectOptions !== undefined ? inspect(input, inspectOptions) : input;
+ public async inspectCleanRedactCodeblock(
+ input: any,
+ language: CodeBlockLang,
+ inspectOptions?: BushInspectOptions,
+ length = 1024
+ ) {
+ const {
+ showHidden: _showHidden = false,
+ depth: _depth = 2,
+ colors: _colors = false,
+ customInspect: _customInspect = true,
+ showProxy: _showProxy = false,
+ maxArrayLength: _maxArrayLength = Infinity,
+ maxStringLength: _maxStringLength = Infinity,
+ breakLength: _breakLength = 80,
+ compact: _compact = 3,
+ sorted: _sorted = false,
+ getters: _getters = true
+ } = inspectOptions ?? {};
+ const inspectOptionsWithDefaults: BushInspectOptions = {
+ showHidden: _showHidden,
+ depth: _depth,
+ colors: _colors,
+ customInspect: _customInspect,
+ showProxy: _showProxy,
+ maxArrayLength: _maxArrayLength,
+ maxStringLength: _maxStringLength,
+ breakLength: _breakLength,
+ compact: _compact,
+ sorted: _sorted,
+ getters: _getters
+ };
+ input =
+ typeof input !== 'string' && inspectOptionsWithDefaults !== undefined
+ ? this.inspect(input, inspectOptionsWithDefaults)
+ : input;
input = Util.cleanCodeBlockContent(input);
input = this.redact(input);
return client.util.codeblock(input, length, language);
@@ -527,8 +967,9 @@ export class BushClientUtil extends ClientUtil {
}
}
- /** Gets the channel configs as a TextChannel */
- public async getConfigChannel(channel: 'log' | 'error' | 'dm'): Promise<TextChannel> {
+ /**
+ * Gets a a configured channel as a TextChannel */
+ public async getConfigChannel(channel: keyof typeof client['config']['channels']): Promise<TextChannel> {
return (await client.channels.fetch(client.config.channels[channel])) as unknown as TextChannel;
}
diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts
index 0266b1d..9f91905 100644
--- a/src/lib/extensions/discord-akairo/BushCommand.ts
+++ b/src/lib/extensions/discord-akairo/BushCommand.ts
@@ -164,21 +164,21 @@ export class BushCommand extends Command {
public completelyHide: boolean;
public constructor(id: string, options?: BushCommandOptions) {
+ if (options.args && typeof options.args !== 'function') {
+ options.args.forEach((_, index: number) => {
+ if ('customType' in options.args[index]) {
+ // @ts-expect-error: shut
+ if (!options.args[index]['type']) options.args[index]['type'] = options.args[index]['customType'];
+ delete options.args[index]['customType'];
+ }
+ });
+ }
super(id, options);
- options.category;
this.options = options;
this.hidden = options.hidden || false;
this.restrictedChannels = options.restrictedChannels;
this.restrictedGuilds = options.restrictedGuilds;
this.completelyHide = options.completelyHide;
- if (options.args && typeof options.args !== 'function') {
- options.args.forEach((arg: BushArgumentOptions | CustomBushArgumentOptions) => {
- if (arg['customType']) {
- arg['type'] = arg['customType'];
- delete arg['customType'];
- }
- });
- }
}
public override exec(message: BushMessage, args: any): any;
diff --git a/src/lib/extensions/discord-akairo/BushCommandHandler.ts b/src/lib/extensions/discord-akairo/BushCommandHandler.ts
index cf49f4f..21984ab 100644
--- a/src/lib/extensions/discord-akairo/BushCommandHandler.ts
+++ b/src/lib/extensions/discord-akairo/BushCommandHandler.ts
@@ -34,6 +34,10 @@ export class BushCommandHandler extends CommandHandler {
super(client, options);
}
+ // protected override setup(): void {
+ // super.setup();
+ // }
+
public override async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise<boolean> {
if (command.ownerOnly) {
const isOwner = client.isOwner(message.author);
diff --git a/yarn.lock b/yarn.lock
index f049527..3ef61d7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1338,10 +1338,11 @@ discord-akairo-message-util@NotEnoughUpdates/discord-akairo-message-util:
discord-akairo@NotEnoughUpdates/discord-akairo:
version: 8.2.2
- resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=6bd3a158eb424c177df34c12cd633fd4dd3e38bb"
+ resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=0f30d95714060be2a41f4e1968416b86c0772d2b"
dependencies:
discord-akairo-message-util: NotEnoughUpdates/discord-akairo-message-util
- checksum: 281ec92100473f37add64e350b3f7bae229f84b1e80b0872445d9d324c02eb73ca19350bee102e05d2a84ec65890db575cd852cd53390dd461a16f8e37ba760f
+ source-map-support: ^0.5.19
+ checksum: 2a81e7efb334e85e8250ee01e6048d0d6ec81a005f4e82457ed9c9ac7ceab0596184076451c8601f7e0fc30230e0f769f6644ec396443ba3017b96e403cbdb0a
languageName: node
linkType: hard
@@ -1367,8 +1368,8 @@ discord-akairo@NotEnoughUpdates/discord-akairo:
linkType: hard
discord.js@NotEnoughUpdates/discord.js:
- version: 13.0.0
- resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=c510de9d608a8259099b98d6699412334a29dca2"
+ version: 13.1.0-dev
+ resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=895e2ed3af4e9d5de653c7fcd20011b6f38f9b25"
dependencies:
"@discordjs/builders": ^0.4.0
"@discordjs/collection": ^0.2.1
@@ -1378,7 +1379,7 @@ discord.js@NotEnoughUpdates/discord.js:
discord-api-types: ^0.22.0
node-fetch: ^2.6.1
ws: ^7.5.1
- checksum: c1dcb0802e83013b8996bb20e2e9c1c6663db9c09eeee46b9778fbad9d68a88066aebd2c52f14e6e1ff2134a2629a0f80b641df20eb0813f699312fded69575f
+ checksum: f4c108870a1eee2ac597c20ae49181cea86e2634df40d9e5d6575c009cf3dd2ab5f09bccf7dad6456307a666c5b2dbd5c2c161727cd343297c87f6902dd3ec4c
languageName: node
linkType: hard
@@ -3692,9 +3693,9 @@ resolve@^1.19.0:
linkType: hard
"smart-buffer@npm:^4.1.0":
- version: 4.1.0
- resolution: "smart-buffer@npm:4.1.0"
- checksum: 1db847dcf92c06b36e96aace965e00aec5caccd65c8fd60e0c284c5ad9dabe7f16ef4a60a34dd3c4ccc245a8393071e646fc94fc95f111c25e8513fd9efa6ed5
+ version: 4.2.0
+ resolution: "smart-buffer@npm:4.2.0"
+ checksum: b5167a7142c1da704c0e3af85c402002b597081dd9575031a90b4f229ca5678e9a36e8a374f1814c8156a725d17008ae3bde63b92f9cfd132526379e580bec8b
languageName: node
linkType: hard