From 342b01c7f51dbe8beef1d3deb37822080ed6097f Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 1 Jan 2022 17:03:48 -0500 Subject: a few things --- src/arguments/abbreviatedNumber.ts | 2 + src/commands/config/config.ts | 2 +- src/commands/config/disable.ts | 2 + src/commands/dev/javascript.ts | 2 + src/commands/dev/sh.ts | 2 + src/commands/dev/test.ts | 27 +- src/commands/fun/coinflip.ts | 26 -- src/commands/fun/dice.ts | 2 +- src/commands/fun/eightBall.ts | 6 +- src/commands/fun/minesweeper.ts | 2 + src/commands/index.ts | 75 ++++++ src/commands/info/botInfo.ts | 3 + src/commands/info/color.ts | 2 + src/commands/info/help.ts | 3 + src/commands/info/links.ts | 2 + src/commands/leveling/level.ts | 4 + src/commands/moderation/_activePunishments.ts | 2 +- src/commands/moderation/hideCase.ts | 2 +- src/commands/moderation/slowmode.ts | 2 +- src/commands/moderation/timeout.ts | 2 +- src/commands/moderation/unlockdown.ts | 4 +- src/commands/moulberry-bush/capePermissions.ts | 79 ++++++ src/commands/moulberry-bush/capePerms.ts | 79 ------ src/commands/moulberry-bush/capes.ts | 5 +- src/commands/moulberry-bush/report.ts | 2 + src/commands/moulberry-bush/serverStatus.ts | 2 + src/commands/utilities/activity.ts | 73 ++++-- src/commands/utilities/calculator.ts | 2 + src/commands/utilities/hash.ts | 3 + src/commands/utilities/price.ts | 3 + src/commands/utilities/reminders.ts | 2 + src/commands/utilities/steal.ts | 2 + src/commands/utilities/suicide.ts | 2 +- src/commands/utilities/wolframAlpha.ts | 2 + src/context-menu-commands/message/viewRaw.ts | 2 +- src/context-menu-commands/user/userInfo.ts | 2 +- src/lib/common/typings/BushInspectOptions.d.ts | 101 -------- src/lib/common/typings/BushInspectOptions.ts | 101 ++++++++ src/lib/common/typings/CodeBlockLang.d.ts | 310 ----------------------- src/lib/common/typings/CodeBlockLang.ts | 310 +++++++++++++++++++++++ src/lib/extensions/discord-akairo/BushCommand.ts | 4 +- src/tasks/updateStats.ts | 3 +- src/tasks/updateSuperUsers.ts | 3 +- 43 files changed, 696 insertions(+), 570 deletions(-) delete mode 100644 src/commands/fun/coinflip.ts create mode 100644 src/commands/index.ts create mode 100644 src/commands/moulberry-bush/capePermissions.ts delete mode 100644 src/commands/moulberry-bush/capePerms.ts delete mode 100644 src/lib/common/typings/BushInspectOptions.d.ts create mode 100644 src/lib/common/typings/BushInspectOptions.ts delete mode 100644 src/lib/common/typings/CodeBlockLang.d.ts create mode 100644 src/lib/common/typings/CodeBlockLang.ts (limited to 'src') 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 = (_, 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 '], - examples: ['8Ball does anyone love me?'], + usage: ['eightball '], + 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 = (_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 '], 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 '], 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/capePermissions.ts b/src/commands/moulberry-bush/capePermissions.ts new file mode 100644 index 0000000..c873095 --- /dev/null +++ b/src/commands/moulberry-bush/capePermissions.ts @@ -0,0 +1,79 @@ +import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import { MessageEmbed } from 'discord.js'; +import got from 'got'; + +export default class CapePermissionsCommand extends BushCommand { + public constructor() { + super('capePermissions', { + aliases: ['cape-permissions', 'cape-perms', 'cape-perm'], + category: "Moulberry's Bush", + description: 'A command to see what capes someone has access to.', + usage: ['cape-permissions '], + examples: ['cape-permissions IRONM00N'], + args: [ + { + id: 'ign', + description: 'The ign of the player you would like to view the capes permissions of.', + type: 'string', + prompt: 'Who would you like to see the cape permissions of?', + retry: '{error} Choose someone to see the capes their available capes.', + slashType: 'STRING' + } + ], + slash: true, + clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true), + userPermissions: [], + channel: 'guild' + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, args: { ign: ArgType<'string'> }) { + interface CapePerms { + success: boolean; + perms: User[]; + } + + interface User { + _id: string; + perms: string[]; + } + + let capePerms: CapePerms | null, uuid: string; + try { + uuid = await util.mcUUID(args.ign); + } catch (e) { + return await message.util.reply(`${util.emojis.error} \`${args.ign}\` doesn't appear to be a valid username.`); + } + + try { + capePerms = await got.get('http://moulberry.codes/permscapes.json').json(); + } catch (error) { + capePerms = null; + } + if (capePerms == null) { + return await message.util.reply(`${util.emojis.error} There was an error finding cape perms for \`${args.ign}\`.`); + } else { + if (capePerms?.perms) { + let index = null; + + for (let i = 0; i < capePerms.perms.length; i++) { + if (capePerms.perms[i]._id == uuid) { + index = i; + break; + } + continue; + } + if (index == null) + return await message.util.reply(`${util.emojis.error} \`${args.ign}\` does not appear to have any capes.`); + const userPerm: string[] = capePerms.perms[index].perms; + const embed = new MessageEmbed() + .setTitle(`${args.ign}'s Capes`) + .setDescription(userPerm.join('\n')) + .setColor(util.colors.default); + await message.util.reply({ embeds: [embed] }); + } else { + return await message.util.reply(`${util.emojis.error} There was an error finding cape perms for ${args.ign}.`); + } + } + } +} diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts deleted file mode 100644 index 71ca78e..0000000 --- a/src/commands/moulberry-bush/capePerms.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { MessageEmbed } from 'discord.js'; -import got from 'got'; - -export default class CapePermissionsCommand extends BushCommand { - public constructor() { - super('capePermissions', { - aliases: ['cape-perms', 'cape-perm', 'cape-permissions'], - category: "Moulberry's Bush", - description: 'A command to see what capes someone has access to.', - usage: ['cape-perms '], - examples: ['cape-perms IRONM00N'], - args: [ - { - id: 'ign', - description: 'The ign of the player you would like to view the capes permissions of.', - type: 'string', - prompt: 'Who would you like to see the cape permissions of?', - retry: '{error} Choose someone to see the capes their available capes.', - slashType: 'STRING' - } - ], - slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true), - userPermissions: [], - channel: 'guild' - }); - } - - public override async exec(message: BushMessage | BushSlashMessage, args: { ign: ArgType<'string'> }) { - interface CapePerms { - success: boolean; - perms: User[]; - } - - interface User { - _id: string; - perms: string[]; - } - - let capePerms: CapePerms | null, uuid: string; - try { - uuid = await util.mcUUID(args.ign); - } catch (e) { - return await message.util.reply(`${util.emojis.error} \`${args.ign}\` doesn't appear to be a valid username.`); - } - - try { - capePerms = await got.get('http://moulberry.codes/permscapes.json').json(); - } catch (error) { - capePerms = null; - } - if (capePerms == null) { - return await message.util.reply(`${util.emojis.error} There was an error finding cape perms for \`${args.ign}\`.`); - } else { - if (capePerms?.perms) { - let index = null; - - for (let i = 0; i < capePerms.perms.length; i++) { - if (capePerms.perms[i]._id == uuid) { - index = i; - break; - } - continue; - } - if (index == null) - return await message.util.reply(`${util.emojis.error} \`${args.ign}\` does not appear to have any capes.`); - const userPerm: string[] = capePerms.perms[index].perms; - const embed = new MessageEmbed() - .setTitle(`${args.ign}'s Capes`) - .setDescription(userPerm.join('\n')) - .setColor(util.colors.default); - await message.util.reply({ embeds: [embed] }); - } else { - return await message.util.reply(`${util.emojis.error} There was an error finding cape perms for ${args.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 = (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 { + 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: 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 (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.d.ts deleted file mode 100644 index 38c70b1..0000000 --- a/src/lib/common/typings/BushInspectOptions.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { type InspectOptions } from 'util'; - -/** - * {@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; -} diff --git a/src/lib/common/typings/BushInspectOptions.ts b/src/lib/common/typings/BushInspectOptions.ts new file mode 100644 index 0000000..38c70b1 --- /dev/null +++ b/src/lib/common/typings/BushInspectOptions.ts @@ -0,0 +1,101 @@ +import { type InspectOptions } from 'util'; + +/** + * {@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; +} diff --git a/src/lib/common/typings/CodeBlockLang.d.ts b/src/lib/common/typings/CodeBlockLang.d.ts deleted file mode 100644 index 5a1aeba..0000000 --- a/src/lib/common/typings/CodeBlockLang.d.ts +++ /dev/null @@ -1,310 +0,0 @@ -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'; diff --git a/src/lib/common/typings/CodeBlockLang.ts b/src/lib/common/typings/CodeBlockLang.ts new file mode 100644 index 0000000..5a1aeba --- /dev/null +++ b/src/lib/common/typings/CodeBlockLang.ts @@ -0,0 +1,310 @@ +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'; 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(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(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() { -- cgit