aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json5
-rw-r--r--src/arguments/abbreviatedNumber.ts2
-rw-r--r--src/commands/config/config.ts2
-rw-r--r--src/commands/config/disable.ts2
-rw-r--r--src/commands/dev/javascript.ts2
-rw-r--r--src/commands/dev/sh.ts2
-rw-r--r--src/commands/dev/test.ts27
-rw-r--r--src/commands/fun/coinflip.ts26
-rw-r--r--src/commands/fun/dice.ts2
-rw-r--r--src/commands/fun/eightBall.ts6
-rw-r--r--src/commands/fun/minesweeper.ts2
-rw-r--r--src/commands/index.ts75
-rw-r--r--src/commands/info/botInfo.ts3
-rw-r--r--src/commands/info/color.ts2
-rw-r--r--src/commands/info/help.ts3
-rw-r--r--src/commands/info/links.ts2
-rw-r--r--src/commands/leveling/level.ts4
-rw-r--r--src/commands/moderation/_activePunishments.ts2
-rw-r--r--src/commands/moderation/hideCase.ts2
-rw-r--r--src/commands/moderation/slowmode.ts2
-rw-r--r--src/commands/moderation/timeout.ts2
-rw-r--r--src/commands/moderation/unlockdown.ts4
-rw-r--r--src/commands/moulberry-bush/capePermissions.ts (renamed from src/commands/moulberry-bush/capePerms.ts)6
-rw-r--r--src/commands/moulberry-bush/capes.ts5
-rw-r--r--src/commands/moulberry-bush/report.ts2
-rw-r--r--src/commands/moulberry-bush/serverStatus.ts2
-rw-r--r--src/commands/utilities/activity.ts73
-rw-r--r--src/commands/utilities/calculator.ts2
-rw-r--r--src/commands/utilities/hash.ts3
-rw-r--r--src/commands/utilities/price.ts3
-rw-r--r--src/commands/utilities/reminders.ts2
-rw-r--r--src/commands/utilities/steal.ts2
-rw-r--r--src/commands/utilities/suicide.ts2
-rw-r--r--src/commands/utilities/wolframAlpha.ts2
-rw-r--r--src/context-menu-commands/message/viewRaw.ts2
-rw-r--r--src/context-menu-commands/user/userInfo.ts2
-rw-r--r--src/lib/common/typings/BushInspectOptions.ts (renamed from src/lib/common/typings/BushInspectOptions.d.ts)0
-rw-r--r--src/lib/common/typings/CodeBlockLang.ts (renamed from src/lib/common/typings/CodeBlockLang.d.ts)0
-rw-r--r--src/lib/extensions/discord-akairo/BushCommand.ts4
-rw-r--r--src/tasks/updateStats.ts3
-rw-r--r--src/tasks/updateSuperUsers.ts3
-rw-r--r--tsconfig.json33
42 files changed, 240 insertions, 90 deletions
diff --git a/package.json b/package.json
index 88727d5..9c9ad33 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,9 @@
},
"#args": {
"default": "./src/arguments/index.js"
+ },
+ "#commands": {
+ "default": "./src/commands/index.js"
}
},
"scripts": {
@@ -103,4 +106,4 @@
"eslint-plugin-deprecation": "^1.3.2"
},
"packageManager": "yarn@3.1.1"
-}
+} \ No newline at end of file
diff --git a/src/arguments/abbreviatedNumber.ts b/src/arguments/abbreviatedNumber.ts
index 3027cb2..a98699c 100644
--- a/src/arguments/abbreviatedNumber.ts
+++ b/src/arguments/abbreviatedNumber.ts
@@ -1,5 +1,7 @@
import { type BushArgumentTypeCaster } from '#lib';
+import assert from 'assert';
import numeral from 'numeral';
+assert(typeof numeral === 'function');
export const abbreviatedNumber: BushArgumentTypeCaster<number | null> = (_, phrase) => {
if (!phrase) return null;
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 1251f1f..c7da64f 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -26,7 +26,7 @@ import {
} from 'discord.js';
import _ from 'lodash';
-export default class SettingsCommand extends BushCommand {
+export default class ConfigCommand extends BushCommand {
public constructor() {
super('config', {
aliases: ['config', 'settings', 'setting', 'configure'],
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index b827734..564f90f 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -1,6 +1,8 @@
import { AllowedMentions, BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { AutocompleteInteraction } from 'discord.js';
import Fuse from 'fuse.js';
+assert(Fuse);
export default class DisableCommand extends BushCommand {
private static blacklistedCommands = ['eval', 'disable'];
diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts
index 8c5dcb4..c8113aa 100644
--- a/src/commands/dev/javascript.ts
+++ b/src/commands/dev/javascript.ts
@@ -1,6 +1,8 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { MessageEmbed } from 'discord.js';
import { VM } from 'vm2';
+assert(VM);
export default class JavascriptCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts
index e6398b6..9956897 100644
--- a/src/commands/dev/sh.ts
+++ b/src/commands/dev/sh.ts
@@ -1,8 +1,10 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import chalk from 'chalk';
import { exec } from 'child_process';
import { MessageEmbed, Util } from 'discord.js';
import { promisify } from 'util';
+assert(chalk);
const sh = promisify(exec);
const clean = (text: string | any) => {
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 247ae20..2c4e34d 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -1,12 +1,6 @@
import { BushCommand, ButtonPaginator, type BushMessage } from '#lib';
-import {
- Constants as jsConstants,
- MessageActionRow,
- MessageButton,
- MessageEmbed,
- type ApplicationCommand,
- type Collection
-} from 'discord.js';
+import { MessageActionRow, MessageButton, MessageEmbed, type ApplicationCommand, type Collection } from 'discord.js';
+import { MessageButtonStyles } from 'discord.js/typings/enums';
export default class TestCommand extends BushCommand {
public constructor() {
@@ -46,14 +40,13 @@ export default class TestCommand extends BushCommand {
return await message.util.reply(responses[Math.floor(Math.random() * responses.length)]);
}
- const s = jsConstants.MessageButtonStyles;
if (['button', 'buttons'].includes(args?.feature?.toLowerCase())) {
const ButtonRow = new MessageActionRow().addComponents(
- new MessageButton({ style: s.PRIMARY, customId: 'primaryButton', label: 'Primary' }),
- new MessageButton({ style: s.SECONDARY, customId: 'secondaryButton', label: 'Secondary' }),
- new MessageButton({ style: s.SUCCESS, customId: 'success', label: 'Success' }),
- new MessageButton({ style: s.DANGER, customId: 'danger', label: 'Danger' }),
- new MessageButton({ style: s.LINK, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })
+ new MessageButton({ style: MessageButtonStyles.PRIMARY, customId: 'primaryButton', label: 'Primary' }),
+ new MessageButton({ style: MessageButtonStyles.SECONDARY, customId: 'secondaryButton', label: 'Secondary' }),
+ new MessageButton({ style: MessageButtonStyles.SUCCESS, customId: 'success', label: 'Success' }),
+ new MessageButton({ style: MessageButtonStyles.DANGER, customId: 'danger', label: 'Danger' }),
+ new MessageButton({ style: MessageButtonStyles.LINK, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })
);
return await message.util.reply({ content: 'buttons', components: [ButtonRow] });
} else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) {
@@ -73,7 +66,7 @@ export default class TestCommand extends BushCommand {
const buttonRow = new MessageActionRow().addComponents(
new MessageButton({
- style: jsConstants.MessageButtonStyles.LINK,
+ style: MessageButtonStyles.LINK,
label: 'Link',
url: 'https://www.google.com/'
})
@@ -86,7 +79,7 @@ export default class TestCommand extends BushCommand {
for (let b = 1; b <= 5; b++) {
const id = (a + 5 * (b - 1)).toString();
const button = new MessageButton({
- style: jsConstants.MessageButtonStyles.SECONDARY,
+ style: MessageButtonStyles.SECONDARY,
customId: id,
label: id
});
@@ -132,7 +125,7 @@ export default class TestCommand extends BushCommand {
for (let b = 1; b <= 5; b++) {
const id = (a + 5 * (b - 1)).toString();
const button = new MessageButton({
- style: jsConstants.MessageButtonStyles.SECONDARY,
+ style: MessageButtonStyles.SECONDARY,
customId: id,
label: id
});
diff --git a/src/commands/fun/coinflip.ts b/src/commands/fun/coinflip.ts
deleted file mode 100644
index cd436f8..0000000
--- a/src/commands/fun/coinflip.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-
-export default class CoinFlipCommand extends BushCommand {
- public constructor() {
- super('coinflip', {
- aliases: ['coinflip', 'cf'],
- category: 'fun',
- description: 'Flip a virtual coin.',
- usage: ['coinflip'],
- examples: ['coinflip'],
- clientPermissions: (m) => util.clientSendAndPermCheck(m),
- userPermissions: [],
- slash: true
- });
- }
-
- public override async exec(message: BushMessage | BushSlashMessage) {
- const random = Math.random();
- let result: string;
- const fall = message.author.id === '322862723090219008' ? 0.1 : 0.001; //dw about it
- if (random < fall) result = 'The coin fell off the table :(';
- else if (random <= 0.5 + fall / 2) result = 'Heads';
- else result = 'Tails';
- await message.util.reply(result);
- }
-}
diff --git a/src/commands/fun/dice.ts b/src/commands/fun/dice.ts
index 2f96e1c..53fc9e2 100644
--- a/src/commands/fun/dice.ts
+++ b/src/commands/fun/dice.ts
@@ -1,6 +1,6 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-export default class EightBallCommand extends BushCommand {
+export default class DiceCommand extends BushCommand {
public constructor() {
super('dice', {
aliases: ['dice', 'die'],
diff --git a/src/commands/fun/eightBall.ts b/src/commands/fun/eightBall.ts
index d6b0b8c..b4d2fbe 100644
--- a/src/commands/fun/eightBall.ts
+++ b/src/commands/fun/eightBall.ts
@@ -3,11 +3,11 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
export default class EightBallCommand extends BushCommand {
public constructor() {
super('eightBall', {
- aliases: ['8ball', 'eightball'],
+ aliases: ['eightball', '8ball'],
category: 'fun',
description: 'Ask questions for a randomly generated response.',
- usage: ['8Ball <question>'],
- examples: ['8Ball does anyone love me?'],
+ usage: ['eightball <question>'],
+ examples: ['eightball does anyone love me?'],
args: [
{
id: 'question',
diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts
index 5e0b452..6878c05 100644
--- a/src/commands/fun/minesweeper.ts
+++ b/src/commands/fun/minesweeper.ts
@@ -1,5 +1,7 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
import { Minesweeper } from '@notenoughupdates/discord.js-minesweeper';
+import assert from 'assert';
+assert(Minesweeper);
export default class MinesweeperCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/index.ts b/src/commands/index.ts
new file mode 100644
index 0000000..a9db0de
--- /dev/null
+++ b/src/commands/index.ts
@@ -0,0 +1,75 @@
+export { default as ChannelPermissionsCommand } from './admin/channelPermissions.js';
+export { default as RoleAllCommand } from './admin/roleAll.js';
+export { default as BlacklistCommand } from './config/blacklist.js';
+export { default as ConfigCommand } from './config/config.js';
+export { default as DisableCommand } from './config/disable.js';
+export { default as FeaturesCommand } from './config/features.js';
+export { default as LogCommand } from './config/log.js';
+export { default as DMCommand } from './dev/dm.js';
+export { default as EvalCommand } from './dev/eval.js';
+export { default as JavascriptCommand } from './dev/javascript.js';
+export { default as ReloadCommand } from './dev/reload.js';
+export { default as SayCommand } from './dev/say.js';
+export { default as ServersCommand } from './dev/servers.js';
+export { default as ShCommand } from './dev/sh.js';
+export { default as SuperUserCommand } from './dev/superUser.js';
+export { default as TestCommand } from './dev/test.js';
+export { default as TemplateCommand } from './dev/__template.js';
+export { default as CoinFlipCommand } from './fun/coinFlip.js';
+export { default as DiceCommand } from './fun/dice.js';
+export { default as EightBallCommand } from './fun/eightBall.js';
+export { default as MinesweeperCommand } from './fun/minesweeper.js';
+export { default as AvatarCommand } from './info/avatar.js';
+export { default as BotInfoCommand } from './info/botInfo.js';
+export { default as ColorCommand } from './info/color.js';
+export { default as GuildInfoCommand } from './info/guildInfo.js';
+export { default as HelpCommand } from './info/help.js';
+export { default as IconCommand } from './info/icon.js';
+export { default as LinksCommand } from './info/links.js';
+export { default as PingCommand } from './info/ping.js';
+export { default as PronounsCommand } from './info/pronouns.js';
+export { default as SnowflakeCommand } from './info/snowflake.js';
+export { default as UserInfoCommand } from './info/userInfo.js';
+export { default as LeaderboardCommand } from './leveling/leaderboard.js';
+export { default as LevelCommand } from './leveling/level.js';
+export { default as SetLevelCommand } from './leveling/setLevel.js';
+export { default as SetXpCommand } from './leveling/setXp.js';
+export { default as BanCommand } from './moderation/ban.js';
+export { default as BlockCommand } from './moderation/block.js';
+export { default as EvidenceCommand } from './moderation/evidence.js';
+export { default as HideCaseCommand } from './moderation/hideCase.js';
+export { default as KickCommand } from './moderation/kick.js';
+export { default as LockdownCommand } from './moderation/lockdown.js';
+export { default as ModlogCommand } from './moderation/modlog.js';
+export { default as MuteCommand } from './moderation/mute.js';
+export { default as PurgeCommand } from './moderation/purge.js';
+export { default as RemoveReactionEmojiCommand } from './moderation/removeReactionEmoji.js';
+export { default as RoleCommand } from './moderation/role.js';
+export { default as SlowmodeCommand } from './moderation/slowmode.js';
+export { default as TimeoutCommand } from './moderation/timeout.js';
+export { default as UnbanCommand } from './moderation/unban.js';
+export { default as UnblockCommand } from './moderation/unblock.js';
+export { default as UnmuteCommand } from './moderation/unmute.js';
+export { default as UntimeoutCommand } from './moderation/untimeout.js';
+export { default as WarnCommand } from './moderation/warn.js';
+export { default as CapePermissionsCommand } from './moulberry-bush/capePermissions.js';
+export { default as CapesCommand } from './moulberry-bush/capes.js';
+export { default as GiveawayPingCommand } from './moulberry-bush/giveawayPing.js';
+export { default as MoulHammerCommand } from './moulberry-bush/moulHammer.js';
+export { default as ReportCommand } from './moulberry-bush/report.js';
+export { default as RuleCommand } from './moulberry-bush/rule.js';
+export { default as ServerStatusCommand } from './moulberry-bush/serverStatus.js';
+export { default as ActivityCommand } from './utilities/activity.js';
+export { default as CalculatorCommand } from './utilities/calculator.js';
+export { default as DecodeCommand } from './utilities/decode.js';
+export { default as HashCommand } from './utilities/hash.js';
+export { default as PriceCommand } from './utilities/price.js';
+export { default as RemindCommand } from './utilities/remind.js';
+export { default as RemindersCommand } from './utilities/reminders.js';
+export { default as StealCommand } from './utilities/steal.js';
+export { default as SuicideCommand } from './utilities/suicide.js';
+export { default as UuidCommand } from './utilities/uuid.js';
+export { default as ViewRawCommand } from './utilities/viewRaw.js';
+export { default as WhoHasRoleCommand } from './utilities/whoHasRole.js';
+export { default as WolframAlphaCommand } from './utilities/wolframAlpha.js';
+export { default as IronmoonCommand } from './_fake-command/ironmoon.js';
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index 56885c5..3fc3d3f 100644
--- a/src/commands/info/botInfo.ts
+++ b/src/commands/info/botInfo.ts
@@ -1,7 +1,10 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { MessageEmbed, version as discordJSVersion } from 'discord.js';
import * as os from 'os';
const { default: prettyBytes } = await import('pretty-bytes');
+assert(prettyBytes);
+assert(os);
export default class BotInfoCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
index 2b8ba9c..5b2c818 100644
--- a/src/commands/info/color.ts
+++ b/src/commands/info/color.ts
@@ -8,8 +8,10 @@ import {
type BushRole,
type BushSlashMessage
} from '#lib';
+import assert from 'assert';
import { MessageEmbed, Role } from 'discord.js';
import tinycolor from 'tinycolor2';
+assert(tinycolor);
const isValidTinyColor: BushArgumentTypeCaster<string | null> = (_message, phase) => {
// if the phase is a number it converts it to hex incase it could be representing a color in decimal
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index c4abf78..1ac7b3e 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -1,7 +1,10 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { AutocompleteInteraction, MessageActionRow, MessageButton, MessageEmbed } from 'discord.js';
import Fuse from 'fuse.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };
+assert(Fuse);
+assert(packageDotJSON);
export default class HelpCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts
index 79f1041..b0d2007 100644
--- a/src/commands/info/links.ts
+++ b/src/commands/info/links.ts
@@ -1,6 +1,8 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { assert } from 'console';
import { MessageActionRow, MessageButton } from 'discord.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };
+assert(packageDotJSON);
export default class LinksCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts
index 47bcdc1..61672a3 100644
--- a/src/commands/leveling/level.ts
+++ b/src/commands/leveling/level.ts
@@ -10,11 +10,15 @@ import {
type BushUser
} from '#lib';
import { SimplifyNumber } from '@notenoughupdates/simplify-number';
+import assert from 'assert';
import canvas from 'canvas';
import { MessageAttachment } from 'discord.js';
import got from 'got';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
+assert(canvas);
+assert(got);
+assert(SimplifyNumber);
export default class LevelCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/moderation/_activePunishments.ts b/src/commands/moderation/_activePunishments.ts
index d40f2ba..98c4912 100644
--- a/src/commands/moderation/_activePunishments.ts
+++ b/src/commands/moderation/_activePunishments.ts
@@ -5,7 +5,7 @@
// export default class ActivePunishmentsCommand extends BushCommand {
// public constructor() {
-// super('active-punishments', {
+// super('activePunishments', {
// aliases: ['active-punishments', 'ap'],
// category: 'moderation',
// description: 'Gets a list of all the active punishment in the server.',
diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts
index de7b310..04160fd 100644
--- a/src/commands/moderation/hideCase.ts
+++ b/src/commands/moderation/hideCase.ts
@@ -3,7 +3,7 @@ import { BushCommand, ModLog, type BushMessage, type BushSlashMessage } from '#l
export default class HideCaseCommand extends BushCommand {
public constructor() {
super('hideCase', {
- aliases: ['hide-case', 'hide_case', 'showcase', 'show_case', 'cover-up-mod-abuse', 'cover_up_mod_abuse'],
+ aliases: ['hide-case', 'hide_case', 'show-case', 'show_case', 'cover-up-mod-abuse', 'cover_up_mod_abuse'],
category: 'moderation',
description: 'Hide a particular modlog case from the modlog command unless the `--hidden` flag is specified',
usage: ['hide-case <case_id>'],
diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts
index 3d53edc..bfa6462 100644
--- a/src/commands/moderation/slowmode.ts
+++ b/src/commands/moderation/slowmode.ts
@@ -2,7 +2,7 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } fr
import { Argument } from 'discord-akairo';
import { type TextChannel, type ThreadChannel } from 'discord.js';
-export default class SlowModeCommand extends BushCommand {
+export default class SlowmodeCommand extends BushCommand {
public constructor() {
super('slowmode', {
aliases: ['slowmode', 'slow'],
diff --git a/src/commands/moderation/timeout.ts b/src/commands/moderation/timeout.ts
index f187a58..3968bde 100644
--- a/src/commands/moderation/timeout.ts
+++ b/src/commands/moderation/timeout.ts
@@ -4,7 +4,7 @@ import assert from 'assert';
export default class TimeoutCommand extends BushCommand {
public constructor() {
super('timeout', {
- aliases: ['timeout'],
+ aliases: ['timeout', 'to'],
category: 'moderation',
description: 'Timeout a user.',
usage: ['timeout <user> <reasonAndDuration>'],
diff --git a/src/commands/moderation/unlockdown.ts b/src/commands/moderation/unlockdown.ts
index 5bcea32..3d363ac 100644
--- a/src/commands/moderation/unlockdown.ts
+++ b/src/commands/moderation/unlockdown.ts
@@ -1,10 +1,10 @@
+import { LockdownCommand } from '#commands';
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib';
-import LockdownCommand from './lockdown.js';
export default class UnlockdownCommand extends BushCommand {
public constructor() {
super('unlockdown', {
- aliases: ['unlockdown', 'unlock'],
+ aliases: ['unlockdown', 'unlock', 'lockup'],
category: 'moderation',
description: 'Allows you to unlockdown a channel or all configured channels.',
usage: ['unlockdown [channel] [reason] [--all]'],
diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePermissions.ts
index 71ca78e..c873095 100644
--- a/src/commands/moulberry-bush/capePerms.ts
+++ b/src/commands/moulberry-bush/capePermissions.ts
@@ -5,11 +5,11 @@ import got from 'got';
export default class CapePermissionsCommand extends BushCommand {
public constructor() {
super('capePermissions', {
- aliases: ['cape-perms', 'cape-perm', 'cape-permissions'],
+ aliases: ['cape-permissions', 'cape-perms', 'cape-perm'],
category: "Moulberry's Bush",
description: 'A command to see what capes someone has access to.',
- usage: ['cape-perms <user>'],
- examples: ['cape-perms IRONM00N'],
+ usage: ['cape-permissions <ign>'],
+ examples: ['cape-permissions IRONM00N'],
args: [
{
id: 'ign',
diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts
index ab6910a..117fd1c 100644
--- a/src/commands/moulberry-bush/capes.ts
+++ b/src/commands/moulberry-bush/capes.ts
@@ -1,7 +1,10 @@
import { BushCommand, ButtonPaginator, DeleteButton, type BushMessage, type OptionalArgType } from '#lib';
+import assert from 'assert';
import { AutocompleteInteraction, type MessageEmbedOptions } from 'discord.js';
import Fuse from 'fuse.js';
import got from 'got';
+assert(Fuse);
+assert(got);
export default class CapesCommand extends BushCommand {
public constructor() {
@@ -9,7 +12,7 @@ export default class CapesCommand extends BushCommand {
aliases: ['capes', 'cape'],
category: "Moulberry's Bush",
description: 'A command to see what a cape looks like.',
- usage: ['cape [cape]'],
+ usage: ['capes [cape]'],
examples: ['capes', 'cape space'],
args: [
{
diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts
index ae67e00..90abc97 100644
--- a/src/commands/moulberry-bush/report.ts
+++ b/src/commands/moulberry-bush/report.ts
@@ -1,6 +1,8 @@
import { AllowedMentions, BushCommand, type ArgType, type BushMessage } from '#lib';
+import assert from 'assert';
import { MessageEmbed } from 'discord.js';
import moment from 'moment';
+assert(moment);
export default class ReportCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts
index 790ac09..3d8e780 100644
--- a/src/commands/moulberry-bush/serverStatus.ts
+++ b/src/commands/moulberry-bush/serverStatus.ts
@@ -1,6 +1,8 @@
import { BushCommand, type BushMessage } from '#lib';
+import assert from 'assert';
import { MessageEmbed } from 'discord.js';
import got from 'got';
+assert(got);
export default class ServerStatusCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts
index e1c2d88..28d466b 100644
--- a/src/commands/utilities/activity.ts
+++ b/src/commands/utilities/activity.ts
@@ -1,5 +1,6 @@
-import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { type DiscordAPIError, type Message } from 'discord.js';
+import { BushCommand, type ArgType, type BushArgumentTypeCaster, type BushMessage, type BushSlashMessage } from '#lib';
+import { type ArgumentOptions, type ArgumentTypeCaster, type Flag } from 'discord-akairo';
+import { type DiscordAPIError, type Snowflake } from 'discord.js';
const activityMap = {
'Poker Night': {
@@ -48,29 +49,34 @@ const activityMap = {
}
};
-function map(phase: string) {
- if (client.consts.regex.snowflake.test(phase)) return phase;
+interface Activity {
+ id: Snowflake;
+ aliases: string[];
+}
+
+function map(phase: string): Activity | null {
+ if (client.consts.regex.snowflake.test(phase)) return { id: phase, aliases: [] };
else if (phase in activityMap) return activityMap[phase as keyof typeof activityMap];
for (const activity in activityMap) {
if (activityMap[activity as keyof typeof activityMap].aliases.includes(phase.toLowerCase()))
- return activityMap[activity as keyof typeof activityMap].id;
+ return activityMap[activity as keyof typeof activityMap];
}
return null;
}
-const activityTypeCaster = (_message: Message | BushMessage | BushSlashMessage, phrase: string) => {
- if (!phrase) return null;
- const mappedPhrase = map(phrase);
- if (mappedPhrase) return mappedPhrase;
- return null;
+const activityTypeCaster: BushArgumentTypeCaster<Snowflake | null> = (message: BushMessage, phrase: string) => {
+ const parsedPhrase = phrase ?? message.util.parsed?.alias !== 'activity' ? message.util.parsed?.alias : undefined;
+ if (!parsedPhrase) return null;
+ const mappedPhrase = map(parsedPhrase)?.id;
+ return mappedPhrase ?? null;
};
-export default class YouTubeCommand extends BushCommand {
+export default class ActivityCommand extends BushCommand {
constructor() {
super('activity', {
- aliases: Object.values(activityMap).flatMap((a) => a.aliases),
+ aliases: ['activity', ...Object.values(activityMap).flatMap((a) => a.aliases)],
category: 'utilities',
description: 'Allows you to play discord activities in voice channels.',
usage: [
@@ -87,9 +93,9 @@ export default class YouTubeCommand extends BushCommand {
description: 'The channel to create the activity in.',
type: 'voiceChannel',
prompt: 'What channel would you like to use?',
- retry: '{error} Choose a valid voice channel',
slashType: 'CHANNEL',
- channelTypes: ['GUILD_VOICE']
+ channelTypes: ['GUILD_VOICE'],
+ only: 'slash'
},
{
id: 'activity',
@@ -114,12 +120,47 @@ export default class YouTubeCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { channel: ArgType<'channel'>; activity: string }) {
+ public override *args(message: BushMessage): Generator<ArgumentOptions | Flag, any, any> {
+ const channel: ArgType<'voiceChannel'> = yield {
+ id: 'channel',
+ description: 'The channel to create the activity in.',
+ type: 'voiceChannel',
+ prompt: {
+ start: 'What channel would you like to use?',
+ retry: '{error} Choose a valid voice channel'
+ }
+ };
+
+ const activity: string = yield {
+ id: 'activity',
+ description: 'The activity to create an invite for.',
+ match: 'rest',
+ type: <ArgumentTypeCaster>activityTypeCaster,
+ prompt: {
+ start: 'What activity would you like to play?',
+ retry: `{error} You must choose one of the following options: ${Object.values(activityMap)
+ .flatMap((a) => a.aliases)
+ .map((a) => `\`${a}\``)
+ .join(', ')}.`,
+ optional: !!(message.util.parsed && message.util.parsed?.alias !== 'activity')
+ },
+ default: message.util.parsed?.alias !== 'activity' ? message.util.parsed?.alias : undefined
+ };
+
+ return { channel, activity };
+ }
+
+ public override async exec(
+ message: BushMessage | BushSlashMessage,
+ args: { channel: ArgType<'voiceChannel'>; activity: string }
+ ) {
const channel = typeof args.channel === 'string' ? message.guild?.channels.cache.get(args.channel) : args.channel;
if (!channel || channel.type !== 'GUILD_VOICE')
return await message.util.reply(`${util.emojis.error} Choose a valid voice channel`);
- const target_application_id = message.util.isSlash ? args.activity : activityTypeCaster(message, args.activity);
+ const target_application_id = message.util.isSlashMessage(message)
+ ? args.activity
+ : activityTypeCaster(message, args.activity);
let response: string;
const invite = await (<any>client).api
diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts
index 2c70dcc..2eeb3a6 100644
--- a/src/commands/utilities/calculator.ts
+++ b/src/commands/utilities/calculator.ts
@@ -1,6 +1,8 @@
import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { MessageEmbed } from 'discord.js';
import { evaluate } from 'mathjs';
+assert(evaluate);
export default class CalculatorCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts
index 7a1bfa7..7e892f5 100644
--- a/src/commands/utilities/hash.ts
+++ b/src/commands/utilities/hash.ts
@@ -1,6 +1,9 @@
import { BushCommand, type BushMessage } from '#lib';
+import assert from 'assert';
import crypto from 'crypto';
import got from 'got';
+assert(crypto);
+assert(got);
export default class HashCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts
index e2cb837..409f544 100644
--- a/src/commands/utilities/price.ts
+++ b/src/commands/utilities/price.ts
@@ -1,7 +1,10 @@
import { BushCommand, type BushMessage } from '#lib';
+import assert from 'assert';
import { AutocompleteInteraction, MessageEmbed } from 'discord.js';
import Fuse from 'fuse.js';
import got from 'got';
+assert(Fuse);
+assert(got);
export default class PriceCommand extends BushCommand {
public static cachedItemList: string[] = [];
diff --git a/src/commands/utilities/reminders.ts b/src/commands/utilities/reminders.ts
index 34034d8..8b4124d 100644
--- a/src/commands/utilities/reminders.ts
+++ b/src/commands/utilities/reminders.ts
@@ -1,6 +1,8 @@
import { BushCommand, ButtonPaginator, Reminder, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { type MessageEmbedOptions } from 'discord.js';
import { Op } from 'sequelize';
+assert(Op);
export default class RemindersCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts
index 67b8382..834fc10 100644
--- a/src/commands/utilities/steal.ts
+++ b/src/commands/utilities/steal.ts
@@ -1,7 +1,9 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import assert from 'assert';
import { type ArgumentOptions, type ArgumentType, type ArgumentTypeCaster, type Flag } from 'discord-akairo';
import _ from 'lodash';
import { URL } from 'url';
+assert(_);
export default class StealCommand extends BushCommand {
public constructor() {
diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts
index b347f9c..d880215 100644
--- a/src/commands/utilities/suicide.ts
+++ b/src/commands/utilities/suicide.ts
@@ -1,7 +1,7 @@
import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { MessageEmbed } from 'discord.js';
-export default class TemplateCommand extends BushCommand {
+export default class SuicideCommand extends BushCommand {
public constructor() {
super('suicide', {
aliases: ['suicide'],
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts
index faf575c..6d8342c 100644
--- a/src/commands/utilities/wolframAlpha.ts
+++ b/src/commands/utilities/wolframAlpha.ts
@@ -1,6 +1,8 @@
import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { initializeClass as WolframAlphaAPI } from '@notenoughupdates/wolfram-alpha-api';
+import assert from 'assert';
import { MessageEmbed, type MessageOptions } from 'discord.js';
+assert(WolframAlphaAPI);
export default class WolframAlphaCommand extends BushCommand {
public constructor() {
diff --git a/src/context-menu-commands/message/viewRaw.ts b/src/context-menu-commands/message/viewRaw.ts
index 2d718dc..1ece8cd 100644
--- a/src/context-menu-commands/message/viewRaw.ts
+++ b/src/context-menu-commands/message/viewRaw.ts
@@ -1,7 +1,7 @@
+import { ViewRawCommand } from '#commands';
import { type BushMessage } from '#lib';
import { ContextMenuCommand } from 'discord-akairo';
import { type ContextMenuInteraction } from 'discord.js';
-import ViewRawCommand from '../../commands/utilities/viewRaw.js';
export default class ViewRawContextMenuCommand extends ContextMenuCommand {
public constructor() {
diff --git a/src/context-menu-commands/user/userInfo.ts b/src/context-menu-commands/user/userInfo.ts
index f654be7..0c43958 100644
--- a/src/context-menu-commands/user/userInfo.ts
+++ b/src/context-menu-commands/user/userInfo.ts
@@ -1,7 +1,7 @@
+import { UserInfoCommand } from '#commands';
import { type BushGuild, type BushGuildMember, type BushUser } from '#lib';
import { ContextMenuCommand } from 'discord-akairo';
import { type ContextMenuInteraction } from 'discord.js';
-import UserInfoCommand from '../../commands/info/userInfo.js';
export default class UserInfoContextMenuCommand extends ContextMenuCommand {
public constructor() {
diff --git a/src/lib/common/typings/BushInspectOptions.d.ts b/src/lib/common/typings/BushInspectOptions.ts
index 38c70b1..38c70b1 100644
--- a/src/lib/common/typings/BushInspectOptions.d.ts
+++ b/src/lib/common/typings/BushInspectOptions.ts
diff --git a/src/lib/common/typings/CodeBlockLang.d.ts b/src/lib/common/typings/CodeBlockLang.ts
index 5a1aeba..5a1aeba 100644
--- a/src/lib/common/typings/CodeBlockLang.d.ts
+++ b/src/lib/common/typings/CodeBlockLang.ts
diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts
index c37a55f..782fae5 100644
--- a/src/lib/extensions/discord-akairo/BushCommand.ts
+++ b/src/lib/extensions/discord-akairo/BushCommand.ts
@@ -510,13 +510,13 @@ export interface BushCommand extends Command {
* @param message - Message that triggered the command.
* @param args - Evaluated arguments.
*/
- exec<R, A>(message: BushMessage, args: A): R;
+ exec(message: BushMessage, args: any): any;
/**
* Executes the command.
* @param message - Message that triggered the command.
* @param args - Evaluated arguments.
*/
- exec<R, A>(message: BushMessage | BushSlashMessage, args: A): R;
+ exec(message: BushMessage | BushSlashMessage, args: any): any;
}
type SlashOptionKeys =
diff --git a/src/tasks/updateStats.ts b/src/tasks/updateStats.ts
index 54c8748..bf8d2ed 100644
--- a/src/tasks/updateStats.ts
+++ b/src/tasks/updateStats.ts
@@ -1,5 +1,4 @@
-import { Stat } from '#lib';
-import { BushTask } from '../lib/extensions/discord-akairo/BushTask.js';
+import { BushTask, Stat } from '#lib';
export default class UpdateStatsTask extends BushTask {
public constructor() {
diff --git a/src/tasks/updateSuperUsers.ts b/src/tasks/updateSuperUsers.ts
index db8ff0a..8dcd00e 100644
--- a/src/tasks/updateSuperUsers.ts
+++ b/src/tasks/updateSuperUsers.ts
@@ -1,5 +1,4 @@
-import { BushTask } from '../lib/extensions/discord-akairo/BushTask.js';
-import { Global } from '../lib/models/Global.js';
+import { BushTask, Global } from '#lib';
export default class UpdateSuperUsersTask extends BushTask {
public constructor() {
diff --git a/tsconfig.json b/tsconfig.json
index 76a2811..0035c38 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -4,7 +4,13 @@
"target": "ESNext",
"moduleResolution": "Node",
"outDir": "dist",
- "lib": ["esnext", "esnext.array", "esnext.asyncIterable", "esnext.intl", "esnext.symbol"],
+ "lib": [
+ "esnext",
+ "esnext.array",
+ "esnext.asyncIterable",
+ "esnext.intl",
+ "esnext.symbol"
+ ],
"sourceMap": true,
"incremental": true,
"experimentalDecorators": true,
@@ -22,10 +28,25 @@
"preserveValueImports": true,
"removeComments": true,
"paths": {
- "#lib": ["./src/lib/index.js"],
- "#args": ["./src/arguments/index.ts"]
+ "#lib": [
+ "./src/lib/index.js"
+ ],
+ "#args": [
+ "./src/arguments/index.ts"
+ ],
+ "#commands": [
+ "./src/commands/index.ts"
+ ]
}
},
- "include": ["src/**/*.ts", "src/**/*d.ts", "lib/**/*.ts", "ecosystem.config.cjs"],
- "exclude": ["dist", "node_modules"]
-}
+ "include": [
+ "src/**/*.ts",
+ "src/**/*d.ts",
+ "lib/**/*.ts",
+ "ecosystem.config.cjs"
+ ],
+ "exclude": [
+ "dist",
+ "node_modules"
+ ]
+} \ No newline at end of file