aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-05 18:26:55 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-05 18:26:55 -0400
commitf4ed3141722719f26ac2286d57a92b1031accaf3 (patch)
tree9d08f8e52d6dd56dd53a5fdbe585d6147db4c795
parentad2077fa157d49c1099f21ac2effe05903c39035 (diff)
downloadtanzanite-f4ed3141722719f26ac2286d57a92b1031accaf3.tar.gz
tanzanite-f4ed3141722719f26ac2286d57a92b1031accaf3.tar.bz2
tanzanite-f4ed3141722719f26ac2286d57a92b1031accaf3.zip
a few fixes and stuff
-rw-r--r--package.json1
-rw-r--r--src/commands/moderation/purge.ts1
-rw-r--r--src/commands/moderation/role.ts2
-rw-r--r--src/commands/utilities/decode.ts11
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts7
-rw-r--r--src/lib/extensions/global.d.ts4
-rw-r--r--yarn.lock12
7 files changed, 32 insertions, 6 deletions
diff --git a/package.json b/package.json
index 1cfd7e8..879c69d 100644
--- a/package.json
+++ b/package.json
@@ -62,6 +62,7 @@
"fuse.js": "^6.4.6",
"got": "^11.8.2",
"humanize-duration": "^3.27.0",
+ "json5": "^2.2.0",
"madge": "^5.0.1",
"module-alias": "^2.2.2",
"moment": "^2.29.1",
diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts
index f4a53a8..4f1a5a6 100644
--- a/src/commands/moderation/purge.ts
+++ b/src/commands/moderation/purge.ts
@@ -52,6 +52,7 @@ export default class PurgeCommand extends BushCommand {
if (args.bot) {
shouldFilter.push(filterMessage.author.bot);
}
+ return shouldFilter.filter((bool) => bool === false).length === 0;
};
const purged = await message.channel.bulkDelete(messages, true).catch(() => {});
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index 1371ee8..0118f22 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -32,7 +32,7 @@ export default class RoleCommand extends BushCommand {
id: 'role',
type: 'role',
prompt: {
- start: `What role do you want to add/remove to/from the user.?`,
+ start: `What role do you want to add/remove to/from the user?`,
retry: `{error} Choose a valid role to add/remove.`
}
},
diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts
index 3fb340d..9f56cfc 100644
--- a/src/commands/utilities/decode.ts
+++ b/src/commands/utilities/decode.ts
@@ -60,7 +60,8 @@ export default class DecodeCommand extends BushCommand {
{ name: 'latin1', value: 'latin1' },
{ name: 'binary', value: 'binary' },
{ name: 'hex', value: 'hex' }
- ]
+ ],
+ required: true
},
{
name: 'to',
@@ -77,12 +78,14 @@ export default class DecodeCommand extends BushCommand {
{ name: 'latin1', value: 'latin1' },
{ name: 'binary', value: 'binary' },
{ name: 'hex', value: 'hex' }
- ]
+ ],
+ required: true
},
{
name: 'data',
description: 'What you would like to decode.',
- type: 'STRING'
+ type: 'STRING',
+ required: true
}
]
});
@@ -92,7 +95,7 @@ export default class DecodeCommand extends BushCommand {
message: BushMessage | AkairoMessage,
{ from, to, data }: { from: BufferEncoding; to: BufferEncoding; data: string }
): Promise<unknown> {
- const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias) || 'Decoded';
+ const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias || 'decoded');
const decodedEmbed = new MessageEmbed()
.setTitle(`${encodeOrDecode} Information`)
.addField('📥 Input', await util.inspectCleanRedactCodeblock(data, null));
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index 8de630f..5b9ac1b 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -15,7 +15,9 @@ import {
Structures,
WebhookEditMessageOptions
} from 'discord.js';
-import * as path from 'path';
+import JSON5 from 'json5';
+import 'json5/lib/register';
+import path from 'path';
import { exit } from 'process';
import readline from 'readline';
import { Sequelize } from 'sequelize';
@@ -100,6 +102,8 @@ type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ?
export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Ready> {
public static preStart(): void {
+ global.JSON5 = JSON5;
+
Structures.extend('GuildEmoji', () => BushGuildEmoji);
Structures.extend('DMChannel', () => BushDMChannel);
Structures.extend('TextChannel', () => BushTextChannel);
@@ -180,6 +184,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
directory: path.join(__dirname, '..', '..', '..', 'commands'),
prefix: async ({ guild }: { guild: Guild }) => {
if (this.config.isDevelopment) return 'dev ';
+ if (!guild) return this.config.prefix;
const row = await GuildModel.findByPk(guild.id);
return (row?.prefix ?? this.config.prefix) as string;
},
diff --git a/src/lib/extensions/global.d.ts b/src/lib/extensions/global.d.ts
index d4c5f61..10869d0 100644
--- a/src/lib/extensions/global.d.ts
+++ b/src/lib/extensions/global.d.ts
@@ -1,12 +1,16 @@
+import { parse, stringify } from 'json5';
import { BushClient } from './discord-akairo/BushClient';
import { BushClientUtil } from './discord-akairo/BushClientUtil';
declare global {
+ type JSON5 = { parse: typeof parse; stringify: typeof stringify };
namespace NodeJS {
export interface Global {
client: BushClient;
util: BushClientUtil;
+ JSON5: JSON5;
}
}
const client: BushClient;
const util: BushClientUtil;
+ const JSON5: JSON5;
}
diff --git a/yarn.lock b/yarn.lock
index 9a727d9..e02976f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -818,6 +818,7 @@ __metadata:
fuse.js: ^6.4.6
got: ^11.8.2
humanize-duration: ^3.27.0
+ json5: ^2.2.0
madge: ^5.0.1
module-alias: ^2.2.2
moment: ^2.29.1
@@ -2383,6 +2384,17 @@ discord.js@NotEnoughUpdates/discord.js:
languageName: node
linkType: hard
+"json5@npm:^2.2.0":
+ version: 2.2.0
+ resolution: "json5@npm:2.2.0"
+ dependencies:
+ minimist: ^1.2.5
+ bin:
+ json5: lib/cli.js
+ checksum: e88fc5274bb58fc99547baa777886b069d2dd96d9cfc4490b305fd16d711dabd5979e35a4f90873cefbeb552e216b041a304fe56702bedba76e19bc7845f208d
+ languageName: node
+ linkType: hard
+
"keyv@npm:^4.0.0":
version: 4.0.3
resolution: "keyv@npm:4.0.3"