diff options
106 files changed, 2086 insertions, 305 deletions
diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..c531fde --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +dist +.yarn +node_modules +*.nnb +tooltips*
\ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 9a6837f..e2d7435 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -115,17 +115,20 @@ const globals = [ 'btoa', 'createImageBitmap', 'fetch', 'queueMicrotask', 'sessionStorage', 'addEventListener', 'removeEventListener' ] +/** + * @type {import('eslint').Linter.Config} + */ module.exports = { env: { - es2021: true, + es2022: true, node: true }, extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], parser: '@typescript-eslint/parser', parserOptions: { - ecmaVersion: 12, + ecmaVersion: 'latest', sourceType: 'module', - project: './tsconfig.json' + project: './tsconfig.eslint.json' }, plugins: ['@typescript-eslint', 'deprecation', 'import'], ignorePatterns: ['dist'], diff --git a/.vscode/typescript.code-snippets b/.vscode/typescript.code-snippets index 6ab1c89..29418b1 100644 --- a/.vscode/typescript.code-snippets +++ b/.vscode/typescript.code-snippets @@ -72,5 +72,66 @@ "\trequired: $3", "},$0" ] + }, + + // prettier-ignore + "Command":{ + "prefix": "command", + "description": "A bot command template", + "body": [ + "import {", + "\tBushCommand,", + "\tclientSendAndPermCheck,", + "\temojis,", + "\ttype ArgType,", + "\ttype CommandMessage,", + "\ttype OptArgType,", + "\ttype SlashMessage", + "} from '#lib';", + "", + "import { ApplicationCommandOptionType } from 'discord.js';", + "export default class ${1:CommandName} extends BushCommand {", + "\tpublic constructor() {", + "\t\tsuper('${2:commandId}', {", + "\t\t\taliases: ['${3:alias}'],", + "\t\t\tcategory: '${4:category}',", + "\t\t\tdescription: '${5:description}.',", + "\t\t\tusage: ['${3:alias} <${6:arg}> [${7:arg}]'],", + "\t\t\texamples: ['${3:alias} ${8:argExample} ${9:argExample}'],", + "\t\t\targs: [", + "\t\t\t\t{", + "\t\t\t\t\tid: '${6:arg}',", + "\t\t\t\t\tdescription: '${10:Argument description}.',", + "\t\t\t\t\ttype: '${11:argType}',", + "\t\t\t\t\tprompt: '${12:What is arg}?',", + "\t\t\t\t\tretry: '{error} ${13:Invalid arg}.',", + "\t\t\t\t\toptional: ${14|true,false|},", + "\t\t\t\t\tslashType: ApplicationCommandOptionType.${15|Subcommand,SubcommandGroup,String,Integer,Boolean,User,Channel,Role,Mentionable,Number,Attachment|}", + "\t\t\t\t},", + "\t\t\t\t{", + "\t\t\t\t\tid: '${7:arg}',", + "\t\t\t\t\tdescription: '${16:Argument description}.',", + "\t\t\t\t\ttype: '${17:argType}',", + "\t\t\t\t\tprompt: '${18:What is arg}?',", + "\t\t\t\t\tretry: '{error} ${19:Invalid arg}.',", + "\t\t\t\t\toptional: ${20|true,false|},", + "\t\t\t\t\tslashType: ApplicationCommandOptionType.${21|Subcommand,SubcommandGroup,String,Integer,Boolean,User,Channel,Role,Mentionable,Number,Attachment|}", + "\t\t\t\t}", + "\t\t\t],", + "\t\t\tslash: ${22|true,false|},", + "\t\t\tchannel: '${23|guild,dm|}',", + "\t\t\tclientPermissions: (m) => clientSendAndPermCheck(m),", + "\t\t\tuserPermissions: []", + "\t\t});", + "\t}", + "", + "\tpublic override async exec(", + "\t\tmessage: CommandMessage | SlashMessage,", + "\t\targs: { ${6:arg}: ArgType<'${10:argType}'>; ${7:arg}: OptArgType<'${16:argType}'> }", + "\t) {", + "\t\t$0", + "\t}", + "}", + ] } } diff --git a/assets/Faithful.ttf b/assets/Faithful.ttf Binary files differnew file mode 100644 index 0000000..aaadb94 --- /dev/null +++ b/assets/Faithful.ttf diff --git a/assets/minecraft_font.ttf b/assets/minecraft_font.ttf Binary files differnew file mode 100644 index 0000000..61b4610 --- /dev/null +++ b/assets/minecraft_font.ttf diff --git a/package.json b/package.json index 97e35ef..f074fd9 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "license": "CC-BY-NC-SA-4.0", "scripts": { "build:esbuild": "yarn rimraf dist && yarn esbuild --sourcemap=inline --outdir=dist --platform=node --target=es2020 --format=esm --log-level=warning src/**/*.ts", - "build:tsc": "yarn rimraf dist && yarn tsc", + "build:tsc": "yarn tsc", "build:tsc:no-emit": "yarn tsc --noEmit", "start:raw": "node --enable-source-maps --experimental-json-modules --no-warnings dist/src/bot.js", "start:esbuild": "yarn build:esbuild && yarn start:raw", @@ -58,28 +58,29 @@ } }, "dependencies": { - "@discordjs/builders": "^0.15.0", - "@discordjs/rest": "^0.5.0", + "@discordjs/builders": "^1.1.0", + "@discordjs/rest": "^1.0.1", + "@ironm00n/nbt-ts": "^1.4.0", "@notenoughupdates/discord.js-minesweeper": "^1.0.10", "@notenoughupdates/events-intercept": "^3.0.1", "@notenoughupdates/humanize-duration": "^4.0.1", "@notenoughupdates/simplify-number": "^1.0.1", "@notenoughupdates/wolfram-alpha-api": "^1.0.2", - "@sentry/integrations": "^7.5.1", - "@sentry/node": "^7.5.1", - "@sentry/tracing": "^7.5.1", + "@sentry/integrations": "^7.9.0", + "@sentry/node": "^7.9.0", + "@sentry/tracing": "^7.9.0", "canvas": "^2.9.3", "chalk": "^5.0.1", "deep-lock": "^1.0.0", "discord-akairo": "npm:@notenoughupdates/discord-akairo@dev", - "discord-api-types": "0.34.0", + "discord-api-types": "0.37.1", "discord.js": "npm:@notenoughupdates/discord.js@dev", "fuse.js": "^6.6.2", "gif-to-apng": "^0.1.2", "googleapis": "^105.0.0", - "got": "^12.1.0", + "got": "^12.3.0", "lodash": "^4.17.21", - "mathjs": "^10.6.4", + "mathjs": "^11.0.1", "nanoid": "^4.0.0", "numeral": "^2.0.6", "pg": "^8.7.3", @@ -87,33 +88,34 @@ "prettier": "^2.7.1", "pretty-bytes": "^6.0.0", "rimraf": "^3.0.2", - "sequelize": "6.21.2", + "sequelize": "6.21.3", "tinycolor2": "^1.4.2", "typescript": "^4.7.4", "vm2": "^3.9.10" }, "devDependencies": { "@sapphire/snowflake": "^3.2.2", - "@sentry/types": "^7.5.1", + "@sentry/types": "^7.9.0", "@types/eslint": "^8.4.5", "@types/express": "^4.17.13", "@types/lodash": "^4.14.182", - "@types/node": "^18.0.3", + "@types/node": "^18.6.4", "@types/numeral": "^2.0.2", "@types/pg": "^8.6.5", - "@types/prettier": "^2.6.3", + "@types/prettier": "^2.7.0", "@types/rimraf": "^3.0.2", "@types/tinycolor2": "^1.4.3", - "@types/validator": "^13.7.4", - "@typescript-eslint/eslint-plugin": "^5.30.5", - "@typescript-eslint/parser": "^5.30.5", - "eslint": "^8.19.0", + "@types/validator": "^13.7.5", + "@typescript-eslint/eslint-plugin": "^5.32.0", + "@typescript-eslint/parser": "^5.32.0", + "electron": "^20.0.1", + "eslint": "^8.21.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-deprecation": "^1.3.2", "eslint-plugin-import": "^2.26.0", - "node-fetch": "^3.2.6", + "node-fetch": "^3.2.10", "ts-essentials": "^9.2.0", - "vitest": "^0.17.1" + "vitest": "^0.21.0" }, "packageManager": "yarn@3.2.2" } diff --git a/src/arguments/abbreviatedNumber.ts b/src/arguments/abbreviatedNumber.ts index eba9214..a7d8ce5 100644 --- a/src/arguments/abbreviatedNumber.ts +++ b/src/arguments/abbreviatedNumber.ts @@ -1,5 +1,5 @@ import type { BushArgumentTypeCaster } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import numeral from 'numeral'; assert(typeof numeral === 'function'); diff --git a/src/arguments/tinyColor.ts b/src/arguments/tinyColor.ts index 8d01928..148c078 100644 --- a/src/arguments/tinyColor.ts +++ b/src/arguments/tinyColor.ts @@ -1,5 +1,5 @@ import type { BushArgumentTypeCaster } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import tinycolorModule from 'tinycolor2'; assert(tinycolorModule); @@ -3,11 +3,11 @@ import { init } from './lib/utils/BushLogger.js'; // also starts a REPL session init(); -const { dirname } = await import('path'); -const { fileURLToPath } = await import('url'); -const { default: config } = await import('../config/options.js'); -const { Sentry } = await import('./lib/common/Sentry.js'); -const { BushClient } = await import('./lib/index.js'); +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; +import { default as config } from '../config/options.js'; +import { Sentry } from './lib/common/Sentry.js'; +import { BushClient } from './lib/index.js'; const isDry = process.argv.includes('dry'); if (!isDry && config.credentials.sentryDsn !== null) new Sentry(dirname(fileURLToPath(import.meta.url)) || process.cwd(), config); diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index 15a1128..0b09e54 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -9,7 +9,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class ChannelPermissionsCommand extends BushCommand { diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts index c731f08..a48bd6b 100644 --- a/src/commands/admin/roleAll.ts +++ b/src/commands/admin/roleAll.ts @@ -8,7 +8,7 @@ import { type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class RoleAllCommand extends BushCommand { diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index 6768a1c..a098f9d 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -10,7 +10,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, GuildMember, PermissionFlagsBits, User } from 'discord.js'; export default class BlacklistCommand extends BushCommand { diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index c562add..cbfc5f7 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -14,7 +14,7 @@ import { type GuildSettingType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo'; import { diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index e9866d5..00dea76 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -9,7 +9,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, AutocompleteInteraction, PermissionFlagsBits } from 'discord.js'; import Fuse from 'fuse.js'; diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index 5eafb0c..625086a 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -9,7 +9,7 @@ import { type GuildFeatures, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ActionRowBuilder, ComponentType, diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts index 3726105..f79f60e 100644 --- a/src/commands/config/log.ts +++ b/src/commands/config/log.ts @@ -9,7 +9,7 @@ import { type GuildLogType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ArgumentGeneratorReturn } from 'discord-akairo'; import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js'; diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index ab7787d..a4a52b5 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -20,7 +20,7 @@ import { type SlashMessage } from '#lib'; import { Snowflake as Snowflake_ } from '@sapphire/snowflake'; -import assert from 'assert'; +import assert from 'assert/strict'; import { Canvas } from 'canvas'; import { exec } from 'child_process'; import { diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index 6b6c7e1..12ad6f7 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -8,7 +8,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; import { VM } from 'vm2'; assert(VM); diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 1b9ce22..609129d 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -8,7 +8,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import chalk from 'chalk'; import { exec } from 'child_process'; import { ApplicationCommandOptionType, cleanCodeBlockContent, EmbedBuilder } from 'discord.js'; diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts index c2fdccf..f2db6ee 100644 --- a/src/commands/fun/minesweeper.ts +++ b/src/commands/fun/minesweeper.ts @@ -8,7 +8,7 @@ import { type SlashMessage } from '#lib'; import { Minesweeper } from '@notenoughupdates/discord.js-minesweeper'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType } from 'discord.js'; assert(Minesweeper); diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index f284e0f..d84fd4e 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -7,7 +7,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { EmbedBuilder, PermissionFlagsBits, version as discordJSVersion } from 'discord.js'; import * as os from 'os'; const { default: prettyBytes } = await import('pretty-bytes'); diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 7286c5c..7601562 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -8,7 +8,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, GuildMember, PermissionFlagsBits, Role } from 'discord.js'; import tinycolor from 'tinycolor2'; assert(tinycolor); diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index dd5704f..e67cdf4 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -12,7 +12,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, ChannelType, diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 1a8eae5..492f25d 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -9,7 +9,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ActionRowBuilder, ApplicationCommandOptionType, diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index e66f900..b3434ec 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -1,5 +1,5 @@ import { BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { EmbedBuilder, escapeMarkdown, PermissionFlagsBits } from 'discord.js'; export default class IconCommand extends BushCommand { diff --git a/src/commands/info/inviteInfo.ts b/src/commands/info/inviteInfo.ts new file mode 100644 index 0000000..5df86ad --- /dev/null +++ b/src/commands/info/inviteInfo.ts @@ -0,0 +1,43 @@ +import { Arg, ArgType, BushCommand, clientSendAndPermCheck, colors, type CommandMessage, type SlashMessage } from '#lib'; +import { ApplicationCommandOptionType, EmbedBuilder, Invite, PermissionFlagsBits } from 'discord.js'; + +export default class InviteInfoCommand extends BushCommand { + public constructor() { + super('inviteInfo', { + aliases: ['invite-info', 'ii'], + category: 'info', + description: 'Get info about an invite.', + usage: ['invite-info [invite]'], + examples: ['invite-info discord.gg/moulberry'], + args: [ + { + id: 'invite', + description: 'The guild to find information about.', + type: 'invite', + prompt: 'What invite would you like to find information about?', + retry: '{error} Choose a valid invite to find information about.', + slashType: ApplicationCommandOptionType.String + } + ], + slash: true, + clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + userPermissions: [] + }); + } + + public override async exec(message: CommandMessage | SlashMessage, args: { invite: ArgType<'invite' | 'string'> }) { + const invite = message.util.isSlashMessage(message) + ? ((await Arg.cast('invite', message, args.invite as string)) as ArgType<'invite'>) + : (args.invite as Invite); + + const inviteInfoEmbed = new EmbedBuilder().setTitle(`Invite to ${invite.guild!.name}`).setColor(colors.default); + + this.generateAboutField(inviteInfoEmbed, invite); + } + + private generateAboutField(embed: EmbedBuilder, invite: Invite) { + const about = [`**code:** ${invite.code}`, `**channel:** ${invite.channel!.name}`]; + + embed.addFields({ name: '» About', value: about.join('\n') }); + } +} diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts index 3c7add2..3dbdbef 100644 --- a/src/commands/info/links.ts +++ b/src/commands/info/links.ts @@ -1,5 +1,5 @@ import { BushCommand, clientSendAndPermCheck, invite, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import packageDotJSON from '../../../package.json' assert { type: 'json' }; diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 3479ea3..7b67816 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -162,11 +162,11 @@ export default class UserInfoCommand extends BushCommand { ); if (member.premiumSince) serverUserInfo.push(`**Booster Since:** ${timestampAndDelta(member.premiumSince, 'd')}`); if (member.displayHexColor) serverUserInfo.push(`**Display Color:** ${member.displayHexColor}`); - if (member.user.id == '322862723090219008' && member.guild?.id == mappings.guilds.bush) + if (member.user.id == mappings.users['IRONM00N'] && member.guild?.id == mappings.guilds["Moulberry's Bush"]) serverUserInfo.push(`**General Deletions:** 1⅓`); if ( - (['384620942577369088', '496409778822709251'] as const).includes(member.user.id) && - member.guild.id == mappings.guilds.bush + ([mappings.users['nopo'], mappings.users['Bestower']] as const).includes(member.user.id) && + member.guild.id == mappings.guilds["Moulberry's Bush"] ) serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${escapeMarkdown(member?.nickname)}`); diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index 7eef990..bb41a12 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -9,7 +9,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class LeaderboardCommand extends BushCommand { diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index 7888695..eda43f2 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -10,7 +10,7 @@ import { type SlashMessage } from '#lib'; import { SimplifyNumber } from '@notenoughupdates/simplify-number'; -import assert from 'assert'; +import assert from 'assert/strict'; import canvas from 'canvas'; import { ApplicationCommandOptionType, AttachmentBuilder, Guild, PermissionFlagsBits, User } from 'discord.js'; import got from 'got'; diff --git a/src/commands/leveling/levelRoles.ts b/src/commands/leveling/levelRoles.ts index 470cf58..312623c 100644 --- a/src/commands/leveling/levelRoles.ts +++ b/src/commands/leveling/levelRoles.ts @@ -8,7 +8,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class LevelRolesCommand extends BushCommand { diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts index b1d9516..8dc1cdf 100644 --- a/src/commands/leveling/setLevel.ts +++ b/src/commands/leveling/setLevel.ts @@ -9,7 +9,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class SetLevelCommand extends BushCommand { diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts index 96b3ad7..5cd3a61 100644 --- a/src/commands/leveling/setXp.ts +++ b/src/commands/leveling/setXp.ts @@ -9,7 +9,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class SetXpCommand extends BushCommand { diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 1b045aa..00fde01 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -13,7 +13,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type User } from 'discord.js'; export default class BanCommand extends BushCommand { diff --git a/src/commands/moderation/block.ts b/src/commands/moderation/block.ts index 48436eb..00a1996 100644 --- a/src/commands/moderation/block.ts +++ b/src/commands/moderation/block.ts @@ -14,7 +14,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class BlockCommand extends BushCommand { diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts index f480844..d36000f 100644 --- a/src/commands/moderation/evidence.ts +++ b/src/commands/moderation/evidence.ts @@ -11,7 +11,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { Argument, ArgumentGeneratorReturn } from 'discord-akairo'; import { ApplicationCommandOptionType, PermissionFlagsBits, type Message } from 'discord.js'; diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts index 6724d3c..9bd1d24 100644 --- a/src/commands/moderation/hideCase.ts +++ b/src/commands/moderation/hideCase.ts @@ -8,7 +8,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; export default class HideCaseCommand extends BushCommand { diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index df14271..7807166 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -12,7 +12,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class KickCommand extends BushCommand { diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts index 1224763..0561767 100644 --- a/src/commands/moderation/lockdown.ts +++ b/src/commands/moderation/lockdown.ts @@ -11,7 +11,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, Collection, diff --git a/src/commands/moderation/massBan.ts b/src/commands/moderation/massBan.ts index 0db5263..db50c44 100644 --- a/src/commands/moderation/massBan.ts +++ b/src/commands/moderation/massBan.ts @@ -13,7 +13,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, Collection, PermissionFlagsBits } from 'discord.js'; export default class MassBanCommand extends BushCommand { diff --git a/src/commands/moderation/massEvidence.ts b/src/commands/moderation/massEvidence.ts index 6547203..62f4825 100644 --- a/src/commands/moderation/massEvidence.ts +++ b/src/commands/moderation/massEvidence.ts @@ -11,7 +11,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; import { EvidenceCommand } from '../index.js'; diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 2bcc54d..4671f58 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -14,7 +14,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, escapeMarkdown, PermissionFlagsBits, User } from 'discord.js'; export default class ModlogCommand extends BushCommand { diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 5502a84..4627f2c 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -14,7 +14,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class MuteCommand extends BushCommand { diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index ed5d49d..383c439 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -8,7 +8,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, Collection, PermissionFlagsBits, type Message } from 'discord.js'; export default class PurgeCommand extends BushCommand { diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index a088287..cc3713c 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -8,7 +8,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, Message, PermissionFlagsBits } from 'discord.js'; export default class RemoveReactionEmojiCommand extends BushCommand { diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index 6febaa6..5251be7 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -13,7 +13,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { type ArgumentGeneratorReturn } from 'discord-akairo'; import { ApplicationCommandOptionType, PermissionFlagsBits, type Snowflake } from 'discord.js'; diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 641f88e..44ed84f 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -10,7 +10,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { Argument } from 'discord-akairo'; import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js'; diff --git a/src/commands/moderation/timeout.ts b/src/commands/moderation/timeout.ts index 1ceedf9..3e2b10d 100644 --- a/src/commands/moderation/timeout.ts +++ b/src/commands/moderation/timeout.ts @@ -12,7 +12,7 @@ import { type SlashMessage, type TimeoutResponse } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class TimeoutCommand extends BushCommand { diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index c102434..3a6221a 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -11,7 +11,7 @@ import { type SlashMessage, type UnbanResponse } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type User } from 'discord.js'; export default class UnbanCommand extends BushCommand { diff --git a/src/commands/moderation/unblock.ts b/src/commands/moderation/unblock.ts index f8a57f8..6533da0 100644 --- a/src/commands/moderation/unblock.ts +++ b/src/commands/moderation/unblock.ts @@ -13,7 +13,7 @@ import { type SlashMessage, type UnblockResponse } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class UnblockCommand extends BushCommand { diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index 31944fc..648a178 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -12,7 +12,7 @@ import { type SlashMessage, type UnmuteResponse } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; import { BushCommand } from '../../lib/extensions/discord-akairo/BushCommand.js'; diff --git a/src/commands/moderation/untimeout.ts b/src/commands/moderation/untimeout.ts index aa6665d..6ca28f4 100644 --- a/src/commands/moderation/untimeout.ts +++ b/src/commands/moderation/untimeout.ts @@ -12,7 +12,7 @@ import { type RemoveTimeoutResponse, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class UntimeoutCommand extends BushCommand { diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index 442cddc..e1d1e90 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -14,7 +14,7 @@ import { type SlashMessage, type WarnResponse } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type GuildMember } from 'discord.js'; export default class WarnCommand extends BushCommand { diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 1db2f72..8693dba 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -12,7 +12,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, PermissionFlagsBits, type APIEmbed, type AutocompleteInteraction } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index d93e0c9..8f8941f 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -1,5 +1,5 @@ -import { AllowedMentions, BushCommand, clientSendAndPermCheck, emojis, type CommandMessage } from '#lib'; -import assert from 'assert'; +import { AllowedMentions, BushCommand, clientSendAndPermCheck, emojis, mappings, type CommandMessage } from '#lib'; +import assert from 'assert/strict'; import { PermissionFlagsBits } from 'discord.js'; export default class GiveawayPingCommand extends BushCommand { @@ -24,8 +24,8 @@ export default class GiveawayPingCommand extends BushCommand { cooldown: 1.44e7, //4 hours ratelimit: 1, editable: false, - restrictedGuilds: ['516977525906341928'], - restrictedChannels: ['767782084981817344', '833855738501267456'] + restrictedGuilds: [mappings.guilds["Moulberry's Bush"]], + restrictedChannels: [mappings.channels['giveaways']] }); } diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 0eeb769..7bb514e 100644 --- a/src/commands/moulberry-bush/moulHammer.ts +++ b/src/commands/moulberry-bush/moulHammer.ts @@ -1,5 +1,13 @@ -import { BushCommand, clientSendAndPermCheck, colors, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import { + BushCommand, + clientSendAndPermCheck, + colors, + mappings, + type ArgType, + type CommandMessage, + type SlashMessage +} from '#lib'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class MoulHammerCommand extends BushCommand { @@ -22,8 +30,8 @@ export default class MoulHammerCommand extends BushCommand { ], slash: true, channel: 'guild', - slashGuilds: ['516977525906341928'], - restrictedGuilds: ['516977525906341928'], + slashGuilds: [mappings.guilds["Moulberry's Bush"]], + restrictedGuilds: [mappings.guilds["Moulberry's Bush"]], clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [] }); diff --git a/src/commands/moulberry-bush/neuRepo.ts b/src/commands/moulberry-bush/neuRepo.ts new file mode 100644 index 0000000..d07ba53 --- /dev/null +++ b/src/commands/moulberry-bush/neuRepo.ts @@ -0,0 +1,193 @@ +import { BushCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; +import canvas from 'canvas'; +import { + ApplicationCommandOptionType, + AttachmentBuilder, + AutocompleteInteraction, + CacheType, + PermissionFlagsBits +} from 'discord.js'; +import { dirname, join } from 'path'; +import tinycolor from 'tinycolor2'; +import { fileURLToPath } from 'url'; +import { formattingInfo, RawNeuItem } from '../../lib/common/util/Minecraft.js'; + +export default class NeuRepoCommand extends BushCommand { + public static items: { name: string; id: string }[] = []; + + public constructor() { + super('neuRepo', { + aliases: ['neu-repo', 'repo-item', 'neu-item', 'item-repo'], + category: "Moulberry's Bush", + description: 'Get information about an item from the NEU item repo.', + usage: ['neu-repo <item>'], + examples: ['neu-repo BARRIER'], + args: [ + { + id: 'item', + description: 'The item id that you would like to find neu item information about.', + type: 'string', + prompt: 'What SkyBlock item would you like to get information about?', + retry: '{error} Pick a valid SkyBlock item ID. Try using the slash command for a better experience.', + slashType: ApplicationCommandOptionType.String, + autocomplete: true + } + /* { + id: 'dangerous', + description: 'Whether or not to use the dangerous branch.', + prompt: 'Would you like to use the dangerous branch instead of the master branch?', + match: 'flag', + flag: ['--dangerous', '-d'], + default: false, + optional: true, + slashType: ApplicationCommandOptionType.Boolean + } */ + ], + slash: false, + clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), + userPermissions: [], + ownerOnly: true, + hidden: true + }); + } + + public override async exec( + message: CommandMessage | SlashMessage, + args: { item: ArgType<'string'> /* dangerous: ArgType<'flag'> */ } + ) { + const itemPath = join(import.meta.url, '..', '..', '..', '..', '..', 'neu-item-repo-dangerous', 'items', `${args.item}.json`); + const item = (await import(itemPath, { assert: { type: 'json' } })).default as RawNeuItem; + + const toolTip = this.toolTip(item); + + return message.util.reply({ + files: [new AttachmentBuilder(toolTip, { name: `${item.internalname}.png`, description: item.displayname })] + }); + } + + public toolTip(item: RawNeuItem): Buffer { + canvas.registerFont(join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', 'assets', 'Faithful.ttf'), { + family: 'Faithful' + }); + + const background = '#100010'; + + const width = 250; + const height = 250; + const scale = 10; + + const itemRender = canvas.createCanvas(width, height), + ctx = itemRender.getContext('2d'); + + ctx.globalAlpha = 0.94; + ctx.fillStyle = background; + + // top outside + ctx.fillRect(scale, 0, width - 2 * scale, scale); + + // bottom outside + ctx.fillRect(scale, height - scale, width - 2 * scale, scale); + + // left outside + ctx.fillRect(0, scale, scale, height - 2 * scale); + + // right outside + ctx.fillRect(width - scale, scale, scale, height - 2 * scale); + + // middle + ctx.fillRect(2 * scale, 2 * scale, width - 4 * scale, height - 4 * scale); + + ctx.globalAlpha = 0.78; + + const borderColorStart = parseInt(new tinycolor(this.getPrimaryColour(item.displayname)).toHex(), 16); + const borderColorEnd = ((borderColorStart & 0xfefefe) >> 1) | (borderColorStart & 0xff000000); + + const borderColorStartStr = `#${borderColorStart.toString(16)}`; + const borderColorEndStr = `#${borderColorEnd.toString(16)}`; + + ctx.fillStyle = borderColorStartStr; + + // top highlight + ctx.fillRect(scale, scale, width - 2 * scale, scale); + + // left highlight + ctx.fillRect(scale, 2 * scale, scale, height - 3 * scale); + + // bottom highlight + { + const x = 2 * scale, + y = height - 2 * scale, + w = width - 3 * scale, + h = scale; + const gradient = ctx.createLinearGradient(x, y, x + w, y + h); + gradient.addColorStop(0, borderColorStartStr); + gradient.addColorStop(1, borderColorEndStr); + ctx.fillStyle = gradient; + + ctx.fillRect(x, y, w, h); + } + + // right highlight + { + const x = width - 2 * scale, + y = 2 * scale, + w = scale, + h = height - 4 * scale; + const gradient = ctx.createLinearGradient(x, y, x + w, y + h); + gradient.addColorStop(0, borderColorStartStr); + gradient.addColorStop(1, borderColorEndStr); + ctx.fillStyle = gradient; + + ctx.fillRect(x, y, w, h); + } + + item.displayname.split(''); + + return itemRender.toBuffer(); + } + + // stolen from NEU and modified + public getPrimaryColourCode(displayname: string): code { + let lastColourCode = -99; + let currentColour = 0; + const mostCommon = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (let i = 0; i < displayname.length; i++) { + const c = displayname.charAt(i); + if (c === '\u00A7') { + lastColourCode = i; + } else if (lastColourCode === i - 1) { + const colIndex = '0123456789abcdef'.indexOf(c); + if (colIndex >= 0) { + currentColour = colIndex; + } else { + currentColour = 0; + } + } else if ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.indexOf(c) >= 0) { + if (currentColour > 0) { + mostCommon[currentColour] = mostCommon[currentColour]++; + } + } + } + let mostCommonCount = 0; + for (let index = 0; index < mostCommon.length; index++) { + if (mostCommon[index] > mostCommonCount) { + mostCommonCount = mostCommon[index]; + currentColour = index; + } + } + + return <code>'0123456789abcdef'.charAt(currentColour); + } + + // stolen from NEU and modified + public getPrimaryColour(displayname: string) { + const code = this.getPrimaryColourCode(displayname); + return formattingInfo[`§${code}`].foregroundDarker; + } + + public override async autocomplete(interaction: AutocompleteInteraction<CacheType>) { + return interaction.respond([{ name: 'Blazetekk™ Ham Radio', value: 'BLAZETEKK_HAM_RADIO' }]); + } +} + +type code = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f'; diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 13ef2b6..d0c4f33 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -4,12 +4,13 @@ import { clientSendAndPermCheck, colors, emojis, + mappings, timestampAndDelta, type ArgType, type CommandMessage } from '#lib'; import { stripIndent } from '#tags'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class ReportCommand extends BushCommand { @@ -54,11 +55,12 @@ export default class ReportCommand extends BushCommand { return await message.util.reply(`${emojis.error} This command can only be used in servers where reporting is enabled.`); if (!member) return await message.util.reply(`${emojis.error} Choose someone to report`); - if (member.user.id === '322862723090219008') + if (member.user.id === mappings.users['IRONM00N']) return await message.util.reply({ content: `Thank you for your report! We take these allegations very seriously and have reported <@${member.user.id}> to the FBI!`, allowedMentions: AllowedMentions.none() }); + if (member.user.bot) return await message.util.reply(`${emojis.error} You cannot report a bot <:WeirdChamp:756283321301860382>.`); diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index d58b78e..25a3ef0 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -3,6 +3,7 @@ import { Arg, BushCommand, clientSendAndPermCheck, + mappings, type CommandMessage, type OptArgType, type SlashMessage @@ -98,11 +99,11 @@ export default class RuleCommand extends BushCommand { } ], slash: true, - slashGuilds: ['516977525906341928'], + slashGuilds: [mappings.guilds["Moulberry's Bush"]], channel: 'guild', clientPermissions: (m) => clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true), userPermissions: [], - restrictedGuilds: ['516977525906341928'] + restrictedGuilds: [mappings.guilds["Moulberry's Bush"]] }); } diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index a4d5e45..1237b3f 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -1,5 +1,5 @@ import { BushCommand, clientSendAndPermCheck, colors, emojis, type CommandMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { EmbedBuilder, PermissionFlagsBits } from 'discord.js'; import got from 'got'; diff --git a/src/commands/moulberry-bush/solved.ts b/src/commands/moulberry-bush/solved.ts new file mode 100644 index 0000000..8e123c4 --- /dev/null +++ b/src/commands/moulberry-bush/solved.ts @@ -0,0 +1,44 @@ +import { BushCommand, clientSendAndPermCheck, emojis, mappings, type CommandMessage, type SlashMessage } from '#lib'; +import assert from 'assert/strict'; + +export default class Solved extends BushCommand { + public constructor() { + super('solved', { + aliases: ['solved'], + category: "Moulberry's Bush", + description: 'A command to mark a support threads as solved.', + usage: ['solved'], + examples: ['solved'], + slash: true, + channel: 'guild', + clientPermissions: (m) => clientSendAndPermCheck(m), + userPermissions: [], + slashGuilds: [mappings.guilds["Moulberry's Bush"]], + restrictedGuilds: [mappings.guilds["Moulberry's Bush"]] + }); + } + + public override async exec(message: CommandMessage | SlashMessage) { + assert(message.inGuild()); + assert(message.channel); + + if (!message.channel.isThread()) return message.util.reply(`${emojis.error} This command can only be used in threads.`); + + if (message.channel.parentId !== mappings.channels['neu-support']) + return message.util.reply( + `${emojis.error} This command can only be used in thread that are created in <#${mappings.channels['neu-support']}>.` + ); + + if (message.channel.name.startsWith('[Solved]')) return message.util.reply(`${emojis.error} This thread is already solved.`); + + if (!message.channel.name.startsWith('Support')) + return message.util.reply(`${emojis.error} This thread is not a support thread.`); + + const newName = `[Solved] ${message.channel.name}`; + + await message.channel.setName(newName); + await message.util.reply(`${emojis.success} This thread has been marked as solved.`); + + await message.channel.setArchived(true, `${message.author.tag} (${message.author.id}) marked this support thread as solved.`); + } +} diff --git a/src/commands/tickets/ticket-!.ts b/src/commands/tickets/ticket-!.ts new file mode 100644 index 0000000..6ec4093 --- /dev/null +++ b/src/commands/tickets/ticket-!.ts @@ -0,0 +1,65 @@ +import { BushCommand, clientSendAndPermCheck, deepWriteable, type SlashMessage } from '#lib'; +import { Flag, type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo'; +import { ApplicationCommandOptionType } from 'discord.js'; + +export const ticketSubcommands = deepWriteable({ + create: { + description: 'Create a ticket.', + type: ApplicationCommandOptionType.Subcommand, + options: [ + { + name: 'word', + description: 'What word do you want to highlight?', + retry: '{error} Enter a valid word.', + type: ApplicationCommandOptionType.String, + required: true + } + ] + } +} as const); + +export default class TicketCommand extends BushCommand { + public constructor() { + super('ticket', { + aliases: ['ticket'], + category: 'ticket', + description: 'Manage tickets.', + usage: ['ticket create <reason>'], + examples: ['ticket creates very cool ticket'], + slashOptions: Object.entries(ticketSubcommands).map( + ([subcommand, options]) => ({ name: subcommand, ...options } as SlashOption) + ), + slash: false, + channel: 'guild', + clientPermissions: (m) => clientSendAndPermCheck(m), + userPermissions: [], + ownerOnly: true, + hidden: true + }); + } + + public override *args(): ArgumentGeneratorReturn { + const subcommand: keyof typeof ticketSubcommands = yield { + id: 'subcommand', + type: Object.keys(ticketSubcommands), + prompt: { + start: 'What sub command would you like to use?', + retry: `{error} Valid subcommands are: ${Object.keys(ticketSubcommands) + .map((s) => `\`${s}\``) + .join()}.` + } + }; + + return Flag.continue(`ticket-${subcommand}`); + } + + public override async exec() { + throw new Error('This command is not meant to be executed directly.'); + } + + public override async execSlash(message: SlashMessage, args: { subcommand: string; subcommandGroup?: string }) { + // manual `Flag.continue` + const subcommand = this.handler.modules.get(`ticket-${args.subcommandGroup ?? args.subcommand}`)!; + return subcommand.exec(message, args); + } +} diff --git a/src/commands/tickets/ticket-create.ts b/src/commands/tickets/ticket-create.ts new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/commands/tickets/ticket-create.ts diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index f0db916..c9dbbf2 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -7,7 +7,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; import { evaluate } from 'mathjs'; diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index 6e8c37f..6817f04 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -1,5 +1,5 @@ import { BushCommand, clientSendAndPermCheck, type CommandMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import crypto from 'crypto'; import { ApplicationCommandOptionType } from 'discord.js'; import got from 'got'; diff --git a/src/commands/utilities/highlight-!.ts b/src/commands/utilities/highlight-!.ts index b93f59a..f2ee259 100644 --- a/src/commands/utilities/highlight-!.ts +++ b/src/commands/utilities/highlight-!.ts @@ -186,10 +186,7 @@ export default class HighlightCommand extends BushCommand { throw new Error('This command is not meant to be executed directly.'); } - public override async execSlash( - message: SlashMessage, - args: { subcommand: keyof typeof highlightSubcommands; subcommandGroup?: string } - ) { + public override async execSlash(message: SlashMessage, args: { subcommand: string; subcommandGroup?: string }) { // manual `Flag.continue` const subcommand = this.handler.modules.get(`highlight-${args.subcommandGroup ?? args.subcommand}`)!; return subcommand.exec(message, args); diff --git a/src/commands/utilities/highlight-add.ts b/src/commands/utilities/highlight-add.ts index facee2c..e7d3ec6 100644 --- a/src/commands/utilities/highlight-add.ts +++ b/src/commands/utilities/highlight-add.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, emojis, format, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { highlightSubcommands } from './highlight-!.js'; export default class HighlightAddCommand extends BushCommand { diff --git a/src/commands/utilities/highlight-block.ts b/src/commands/utilities/highlight-block.ts index 9ee8a5a..7843836 100644 --- a/src/commands/utilities/highlight-block.ts +++ b/src/commands/utilities/highlight-block.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { Argument, ArgumentGeneratorReturn } from 'discord-akairo'; import { Channel, GuildMember, User } from 'discord.js'; import { BlockResult } from '../../lib/common/HighlightManager.js'; diff --git a/src/commands/utilities/highlight-clear.ts b/src/commands/utilities/highlight-clear.ts index a5ff19e..5451e4e 100644 --- a/src/commands/utilities/highlight-clear.ts +++ b/src/commands/utilities/highlight-clear.ts @@ -1,5 +1,5 @@ import { BushCommand, ConfirmationPrompt, emojis, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { highlightSubcommands } from './highlight-!.js'; export default class HighlightClearCommand extends BushCommand { diff --git a/src/commands/utilities/highlight-matches.ts b/src/commands/utilities/highlight-matches.ts index 8964af8..863445e 100644 --- a/src/commands/utilities/highlight-matches.ts +++ b/src/commands/utilities/highlight-matches.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, chunk, colors, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { type ArgumentGeneratorReturn } from 'discord-akairo'; import { type APIEmbed } from 'discord.js'; import { highlightSubcommands } from './highlight-!.js'; diff --git a/src/commands/utilities/highlight-remove.ts b/src/commands/utilities/highlight-remove.ts index 67cf029..fd2fa90 100644 --- a/src/commands/utilities/highlight-remove.ts +++ b/src/commands/utilities/highlight-remove.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { highlightSubcommands } from './highlight-!.js'; export default class HighlightRemoveCommand extends BushCommand { diff --git a/src/commands/utilities/highlight-show.ts b/src/commands/utilities/highlight-show.ts index 301d719..bed8f19 100644 --- a/src/commands/utilities/highlight-show.ts +++ b/src/commands/utilities/highlight-show.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, colors, emojis, Highlight, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { EmbedBuilder } from 'discord.js'; import { highlightSubcommands } from './highlight-!.js'; diff --git a/src/commands/utilities/highlight-unblock.ts b/src/commands/utilities/highlight-unblock.ts index d70fb28..d731205 100644 --- a/src/commands/utilities/highlight-unblock.ts +++ b/src/commands/utilities/highlight-unblock.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, emojis, type ArgType, type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { Argument, ArgumentGeneratorReturn } from 'discord-akairo'; import { Channel, GuildMember, User } from 'discord.js'; import { UnblockResult } from '../../lib/common/HighlightManager.js'; diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 3973844..8a3b5c6 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -1,5 +1,5 @@ import { ArgType, BushCommand, clientSendAndPermCheck, colors, emojis, format, oxford, type CommandMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, AutocompleteInteraction, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; diff --git a/src/commands/utilities/reminders.ts b/src/commands/utilities/reminders.ts index 18243fe..fdce981 100644 --- a/src/commands/utilities/reminders.ts +++ b/src/commands/utilities/reminders.ts @@ -10,7 +10,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { PermissionFlagsBits, type APIEmbed } from 'discord.js'; import { Op } from 'sequelize'; diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts index 3741d27..b07338f 100644 --- a/src/commands/utilities/steal.ts +++ b/src/commands/utilities/steal.ts @@ -9,7 +9,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { type ArgumentGeneratorReturn, type ArgumentType, type ArgumentTypeCaster } from 'discord-akairo'; import { ApplicationCommandOptionType, Attachment, PermissionFlagsBits } from 'discord.js'; import _ from 'lodash'; diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index d2aef0d..a7d8b25 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -10,7 +10,7 @@ import { type OptArgType, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, Constants, EmbedBuilder, Message, PermissionFlagsBits } from 'discord.js'; export default class ViewRawCommand extends BushCommand { diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts index 851411a..789701c 100644 --- a/src/commands/utilities/whoHasRole.ts +++ b/src/commands/utilities/whoHasRole.ts @@ -10,7 +10,7 @@ import { type CommandMessage, type SlashMessage } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, escapeMarkdown, type CommandInteraction, type Role } from 'discord.js'; export default class WhoHasRoleCommand extends BushCommand { diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index bac9f58..b35e14f 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -9,7 +9,7 @@ import { type SlashMessage } from '#lib'; import { initializeClass as WolframAlphaAPI } from '@notenoughupdates/wolfram-alpha-api'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ApplicationCommandOptionType, EmbedBuilder, type MessageOptions } from 'discord.js'; assert(WolframAlphaAPI); diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index 21bcb00..093f8af 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -1,5 +1,5 @@ import { colors, emojis, format, formatError, Moderation, unmuteResponse } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import chalk from 'chalk'; import { ActionRowBuilder, diff --git a/src/lib/common/HighlightManager.ts b/src/lib/common/HighlightManager.ts index 4346007..8784b35 100644 --- a/src/lib/common/HighlightManager.ts +++ b/src/lib/common/HighlightManager.ts @@ -1,5 +1,5 @@ import { addToArray, format, Highlight, removeFromArray, timestamp, type HighlightWord } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { Collection, GuildMember, diff --git a/src/lib/common/util/Minecraft.ts b/src/lib/common/util/Minecraft.ts new file mode 100644 index 0000000..a12ebf2 --- /dev/null +++ b/src/lib/common/util/Minecraft.ts @@ -0,0 +1,349 @@ +import { Byte, Int, parse } from '@ironm00n/nbt-ts'; +import { BitField } from 'discord.js'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +export enum FormattingCodes { + Black = '§0', + DarkBlue = '§1', + DarkGreen = '§2', + DarkAqua = '§3', + DarkRed = '§4', + DarkPurple = '§5', + Gold = '§6', + Gray = '§7', + DarkGray = '§8', + Blue = '§9', + Green = '§a', + Aqua = '§b', + Red = '§c', + LightPurple = '§d', + Yellow = '§e', + White = '§f', + + Obfuscated = '§k', + Bold = '§l', + Strikethrough = '§m', + Underline = '§n', + Italic = '§o', + Reset = '§r' +} + +// https://minecraft.fandom.com/wiki/Formatting_codes +export const formattingInfo = { + [FormattingCodes.Black]: { + foreground: 'rgb(0, 0, 0)', + foregroundDarker: 'rgb(0, 0, 0)', + background: 'rgb(0, 0, 0)', + backgroundDarker: 'rgb(0, 0, 0)', + ansi: '\u001b[0;30m' + }, + [FormattingCodes.DarkBlue]: { + foreground: 'rgb(0, 0, 170)', + foregroundDarker: 'rgb(0, 0, 118)', + background: 'rgb(0, 0, 42)', + backgroundDarker: 'rgb(0, 0, 29)', + ansi: '\u001b[0;34m' + }, + [FormattingCodes.DarkGreen]: { + foreground: 'rgb(0, 170, 0)', + foregroundDarker: 'rgb(0, 118, 0)', + background: 'rgb(0, 42, 0)', + backgroundDarker: 'rgb(0, 29, 0)', + ansi: '\u001b[0;32m' + }, + [FormattingCodes.DarkAqua]: { + foreground: 'rgb(0, 170, 170)', + foregroundDarker: 'rgb(0, 118, 118)', + background: 'rgb(0, 42, 42)', + backgroundDarker: 'rgb(0, 29, 29)', + ansi: '\u001b[0;36m' + }, + [FormattingCodes.DarkRed]: { + foreground: 'rgb(170, 0, 0)', + foregroundDarker: 'rgb(118, 0, 0)', + background: 'rgb(42, 0, 0)', + backgroundDarker: 'rgb(29, 0, 0)', + ansi: '\u001b[0;31m' + }, + [FormattingCodes.DarkPurple]: { + foreground: 'rgb(170, 0, 170)', + foregroundDarker: 'rgb(118, 0, 118)', + background: 'rgb(42, 0, 42)', + backgroundDarker: 'rgb(29, 0, 29)', + ansi: '\u001b[0;35m' + }, + [FormattingCodes.Gold]: { + foreground: 'rgb(255, 170, 0)', + foregroundDarker: 'rgb(178, 118, 0)', + background: 'rgb(42, 42, 0)', + backgroundDarker: 'rgb(29, 29, 0)', + ansi: '\u001b[0;33m' + }, + [FormattingCodes.Gray]: { + foreground: 'rgb(170, 170, 170)', + foregroundDarker: 'rgb(118, 118, 118)', + background: 'rgb(42, 42, 42)', + backgroundDarker: 'rgb(29, 29, 29)', + ansi: '\u001b[0;37m' + }, + [FormattingCodes.DarkGray]: { + foreground: 'rgb(85, 85, 85)', + foregroundDarker: 'rgb(59, 59, 59)', + background: 'rgb(21, 21, 21)', + backgroundDarker: 'rgb(14, 14, 14)', + ansi: '\u001b[0;90m' + }, + [FormattingCodes.Blue]: { + foreground: 'rgb(85, 85, 255)', + foregroundDarker: 'rgb(59, 59, 178)', + background: 'rgb(21, 21, 63)', + backgroundDarker: 'rgb(14, 14, 44)', + ansi: '\u001b[0;94m' + }, + [FormattingCodes.Green]: { + foreground: 'rgb(85, 255, 85)', + foregroundDarker: 'rgb(59, 178, 59)', + background: 'rgb(21, 63, 21)', + backgroundDarker: 'rgb(14, 44, 14)', + ansi: '\u001b[0;92m' + }, + [FormattingCodes.Aqua]: { + foreground: 'rgb(85, 255, 255)', + foregroundDarker: 'rgb(59, 178, 178)', + background: 'rgb(21, 63, 63)', + backgroundDarker: 'rgb(14, 44, 44)', + ansi: '\u001b[0;96m' + }, + [FormattingCodes.Red]: { + foreground: 'rgb(255, 85, 85)', + foregroundDarker: 'rgb(178, 59, 59)', + background: 'rgb(63, 21, 21)', + backgroundDarker: 'rgb(44, 14, 14)', + ansi: '\u001b[0;91m' + }, + [FormattingCodes.LightPurple]: { + foreground: 'rgb(255, 85, 255)', + foregroundDarker: 'rgb(178, 59, 178)', + background: 'rgb(63, 21, 63)', + backgroundDarker: 'rgb(44, 14, 44)', + ansi: '\u001b[0;95m' + }, + [FormattingCodes.Yellow]: { + foreground: 'rgb(255, 255, 85)', + foregroundDarker: 'rgb(178, 178, 59)', + background: 'rgb(63, 63, 21)', + backgroundDarker: 'rgb(44, 44, 14)', + ansi: '\u001b[0;93m' + }, + [FormattingCodes.White]: { + foreground: 'rgb(255, 255, 255)', + foregroundDarker: 'rgb(178, 178, 178)', + background: 'rgb(63, 63, 63)', + backgroundDarker: 'rgb(44, 44, 44)', + ansi: '\u001b[0;97m' + }, + + [FormattingCodes.Obfuscated]: { ansi: '\u001b[8m' }, + [FormattingCodes.Bold]: { ansi: '\u001b[1m' }, + [FormattingCodes.Strikethrough]: { ansi: '\u001b[9m' }, + [FormattingCodes.Underline]: { ansi: '\u001b[4m' }, + [FormattingCodes.Italic]: { ansi: '\u001b[3m' }, + [FormattingCodes.Reset]: { ansi: '\u001b[0m' } +} as const; + +export type McItemId = Lowercase<string>; +export type SbItemId = Uppercase<string>; +export type MojangJson = string; +export type SbRecipeItem = `${SbItemId}:${number}` | ''; +export type SbRecipe = { + [Location in `${'A' | 'B' | 'C'}${1 | 2 | 3}`]: SbRecipeItem; +}; +export type InfoType = 'WIKI_URL' | ''; + +export type Slayer = `${'WOLF' | 'BLAZE' | 'EMAN'}_${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`; + +export interface RawNeuItem { + itemid: McItemId; + displayname: string; + nbttag: MojangJson; + damage: number; + lore: string[]; + recipe?: SbRecipe; + internalname: SbItemId; + modver: string; + infoType: InfoType; + info?: string[]; + crafttext: string; + vanilla?: boolean; + useneucraft?: boolean; + slayer_req?: Slayer; + clickcommand?: string; + x?: number; + y?: number; + z?: number; + island?: string; + recipes?: { type: string; cost: any[]; result: SbItemId }[]; + /** @deprecated */ + parent?: SbItemId; + noseal?: boolean; +} + +export enum HideFlagsBits { + Enchantments = 1, + AttributeModifiers = 2, + Unbreakable = 4, + CanDestroy = 8, + CanPlaceOn = 16, + /** + * potion effects, shield pattern info, "StoredEnchantments", written book + * "generation" and "author", "Explosion", "Fireworks", and map tooltips + */ + OtherInformation = 32, + Dyed = 64 +} + +export type HideFlagsString = keyof typeof HideFlagsBits; + +export class HideFlags extends BitField<HideFlagsString> { + public static override Flags = HideFlagsBits; +} + +export const formattingCode = new RegExp( + `§[${Object.values(FormattingCodes) + .filter((v) => v.startsWith('§')) + .map((v) => v.substring(1)) + .join('')}]` +); + +export function removeMCFormatting(str: string) { + return str.replaceAll(formattingCode, ''); +} + +const repo = path.join(__dirname, '..', '..', '..', '..', '..', 'neu-item-repo-dangerous'); + +export interface NbtTag { + overrideMeta?: Byte; + Unbreakable?: Int; + ench?: string[]; + HideFlags?: HideFlags; + SkullOwner?: SkullOwner; + display?: NbtTagDisplay; + ExtraAttributes?: ExtraAttributes; +} + +export interface SkullOwner { + Id?: string; + Properties?: { + textures?: { Value?: string }[]; + }; +} + +export interface NbtTagDisplay { + Lore?: string[]; + color?: Int; + Name?: string; +} + +export type RuneId = string; + +export interface ExtraAttributes { + originTag?: Origin; + id?: string; + generator_tier?: Int; + boss_tier?: Int; + enchantments?: { hardened_mana?: Int }; + dungeon_item_level?: Int; + runes?: { [key: RuneId]: Int }; + petInfo?: PetInfo; +} + +export interface PetInfo { + type: 'ZOMBIE'; + active: boolean; + exp: number; + tier: 'COMMON' | 'UNCOMMON' | 'RARE' | 'EPIC' | 'LEGENDARY'; + hideInfo: boolean; + candyUsed: number; +} + +export type Origin = 'SHOP_PURCHASE'; + +const neuConstantsPath = path.join(repo, 'constants'); +const neuPetsPath = path.join(neuConstantsPath, 'pets.json'); +const neuPets = (await import(neuPetsPath, { assert: { type: 'json' } })) as PetsConstants; +const neuPetNumsPath = path.join(neuConstantsPath, 'petnums.json'); +const neuPetNums = (await import(neuPetNumsPath, { assert: { type: 'json' } })) as PetNums; + +export interface PetsConstants { + pet_rarity_offset: Record<string, number>; + pet_levels: number[]; + custom_pet_leveling: Record<string, { type: number; pet_levels: number[]; max_level: number }>; + pet_types: Record<string, string>; +} + +export interface PetNums { + [key: string]: { + [key: string]: { + '1': { + otherNums: number[]; + statNums: Record<string, number>; + }; + '100': { + otherNums: number[]; + statNums: Record<string, number>; + }; + 'stats_levelling_curve'?: `${number};${number};${number}`; + }; + }; +} + +export class NeuItem { + public itemId: McItemId; + public displayName: string; + public nbtTag: NbtTag; + public internalName: SbItemId; + public lore: string[]; + + public constructor(raw: RawNeuItem) { + this.itemId = raw.itemid; + this.nbtTag = <NbtTag>parse(raw.nbttag); + this.displayName = raw.displayname; + this.internalName = raw.internalname; + this.lore = raw.lore; + + this.petLoreReplacements(); + } + + private petLoreReplacements(level = -1) { + if (/.*?;[0-5]$/.test(this.internalName) && this.displayName.includes('LVL')) { + const maxLevel = neuPets?.custom_pet_leveling?.[this.internalName]?.max_level ?? 100; + this.displayName = this.displayName.replace('LVL', `1➡${maxLevel}`); + + const nums = neuPetNums[this.internalName]; + if (!nums) throw new Error(`Pet (${this.internalName}) has no pet nums.`); + + const teir = ['COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY', 'MYTHIC'][+this.internalName.at(-1)!]; + const petInfoTier = nums[teir]; + if (!petInfoTier) throw new Error(`Pet (${this.internalName}) has no pet nums for ${teir} rarity.`); + + const curve = petInfoTier?.stats_levelling_curve?.split(';'); + + // todo: finish copying from neu + + const minStatsLevel = parseInt(curve?.[0] ?? '0'); + const maxStatsLevel = parseInt(curve?.[0] ?? '100'); + + const lore = ''; + } + } +} + +export function mcToAnsi(str: string) { + for (const format in formattingInfo) { + str = str.replaceAll(format, formattingInfo[format as keyof typeof formattingInfo].ansi); + } + return `${str}\u001b[0m`; +} diff --git a/src/lib/common/util/Minecraft_Test.ts b/src/lib/common/util/Minecraft_Test.ts new file mode 100644 index 0000000..26ca648 --- /dev/null +++ b/src/lib/common/util/Minecraft_Test.ts @@ -0,0 +1,86 @@ +import fs from 'fs/promises'; +import path from 'path'; +import { fileURLToPath } from 'url'; +import { mcToAnsi, RawNeuItem } from './Minecraft.js'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const repo = path.join(__dirname, '..', '..', '..', '..', '..', 'neu-item-repo-dangerous'); +const itemPath = path.join(repo, 'items'); +const items = await fs.readdir(itemPath); + +// for (let i = 0; i < 5; i++) { +for (const path_ of items) { + // const randomItem = items[Math.floor(Math.random() * items.length)]; + // console.log(randomItem); + const item = (await import(path.join(itemPath, /* randomItem */ path_), { assert: { type: 'json' } })).default as RawNeuItem; + if (/.*?((_MONSTER)|(_NPC)|(_ANIMAL)|(_MINIBOSS)|(_BOSS)|(_SC))$/.test(item.internalname)) continue; + if (!/.*?;[0-5]$/.test(item.internalname)) continue; + /* console.log(path_); + console.dir(item, { depth: Infinity }); */ + + /* console.log('==========='); */ + // const nbt = parse(item.nbttag) as NbtTag; + + // if (nbt?.SkullOwner?.Properties?.textures?.[0]?.Value) { + // nbt.SkullOwner.Properties.textures[0].Value = parse( + // Buffer.from(nbt.SkullOwner.Properties.textures[0].Value, 'base64').toString('utf-8') + // ) as string; + // } + + // if (nbt.ExtraAttributes?.petInfo) { + // nbt.ExtraAttributes.petInfo = JSON.parse(nbt.ExtraAttributes.petInfo as any as string); + // } + + // delete nbt.display?.Lore; + + // console.dir(nbt, { depth: Infinity }); + // console.log('==========='); + + /* if (nbt?.display && nbt.display.Name !== item.displayname) + console.log(`${path_} display name mismatch: ${mcToAnsi(nbt.display.Name)} != ${mcToAnsi(item.displayname)}`); + + if (nbt?.ExtraAttributes && nbt?.ExtraAttributes.id !== item.internalname) + console.log(`${path_} internal name mismatch: ${mcToAnsi(nbt?.ExtraAttributes.id)} != ${mcToAnsi(item.internalname)}`); */ + + // console.log('==========='); + + console.log(mcToAnsi(item.displayname)); + console.log(item.lore.map((l) => mcToAnsi(l)).join('\n')); + + /* const keys = [ + 'itemid', + 'displayname', + 'nbttag', + 'damage', + 'lore', + 'recipe', + 'internalname', + 'modver', + 'infoType', + 'info', + 'crafttext', + 'vanilla', + 'useneucraft', + 'slayer_req', + 'clickcommand', + 'x', + 'y', + 'z', + 'island', + 'recipes', + 'parent', + 'noseal' + ]; + + Object.keys(item).forEach((k) => { + if (!keys.includes(k)) throw new Error(`Unknown key: ${k}`); + }); + + if ( + 'slayer_req' in item && + !new Array(10).flatMap((_, i) => ['WOLF', 'BLAZE', 'EMAN'].map((e) => e + (i + 1)).includes(item.slayer_req!)) + ) + throw new Error(`Unknown slayer req: ${item.slayer_req!}`); */ + + /* console.log('=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-'); */ +} diff --git a/src/lib/common/util/Moderation.ts b/src/lib/common/util/Moderation.ts index fc01602..60e32c0 100644 --- a/src/lib/common/util/Moderation.ts +++ b/src/lib/common/util/Moderation.ts @@ -12,7 +12,7 @@ import { type ModLogType, type ValueOf } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ActionRowBuilder, ButtonBuilder, diff --git a/src/lib/extensions/discord.js/ExtendedGuild.ts b/src/lib/extensions/discord.js/ExtendedGuild.ts index c58916c..88bf5f1 100644 --- a/src/lib/extensions/discord.js/ExtendedGuild.ts +++ b/src/lib/extensions/discord.js/ExtendedGuild.ts @@ -11,6 +11,7 @@ import { type GuildLogType, type GuildModel } from '#lib'; +import assert from 'assert/strict'; import { AttachmentBuilder, AttachmentPayload, @@ -735,10 +736,33 @@ export class ExtendedGuild extends Guild { sendOptions.content = 'Wondering who to invite? Start by inviting anyone who can help you build the server!'; break; + // todo: use enum for this + case 24 as MessageType: { + const embed = quote.embeds[0]; + assert.equal(embed.data.type, 'auto_moderation_message'); + const ruleName = embed.fields!.find((f) => f.name === 'rule_name')!.value; + const channelId = embed.fields!.find((f) => f.name === 'channel_id')!.value; + const keyword = embed.fields!.find((f) => f.name === 'keyword')!.value; + + sendOptions.username = `AutoMod (${quote.member?.displayName ?? quote.author.username})`; + sendOptions.content = `Automod has blocked a message in <#${channelId}>`; + sendOptions.embeds = [ + { + title: quote.member?.displayName ?? quote.author.username, + description: embed.description ?? 'There is no content???', + footer: { + text: `Keyword: ${keyword} • Rule: ${ruleName}` + }, + color: 0x36393f + } + ]; + + break; + } case MessageType.ChannelIconChange: case MessageType.Call: default: - sendOptions.content = `${emojis.error} I cannot quote **${ + sendOptions.content = `${emojis.error} I cannot quote messages of type **${ MessageType[quote.type] || quote.type }** messages, please report this to my developers.`; @@ -746,7 +770,7 @@ export class ExtendedGuild extends Guild { } sendOptions.allowedMentions = AllowedMentions.none(); - sendOptions.username = quote.member?.displayName ?? quote.author.username; + sendOptions.username ??= quote.member?.displayName ?? quote.author.username; sendOptions.avatarURL = quote.member?.displayAvatarURL({ size: 2048 }) ?? quote.author.displayAvatarURL({ size: 2048 }); return await webhook.send(sendOptions); /* .catch((e: any) => e); */ diff --git a/src/lib/utils/BushClientUtils.ts b/src/lib/utils/BushClientUtils.ts index af49803..920ff40 100644 --- a/src/lib/utils/BushClientUtils.ts +++ b/src/lib/utils/BushClientUtils.ts @@ -1,4 +1,4 @@ -import assert from 'assert'; +import assert from 'assert/strict'; import { cleanCodeBlockContent, DMChannel, diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 67723e3..8a7bf03 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -200,11 +200,22 @@ export const pronounMapping = Object.freeze({ */ export const mappings = deepLock({ guilds: { - bush: '516977525906341928', - tree: '767448775450820639', - staff: '784597260465995796', - space_ship: '717176538717749358', - sbr: '839287012409999391' + "Moulberry's Bush": '516977525906341928', + "Moulberry's Tree": '767448775450820639', + 'MB Staff': '784597260465995796', + "IRONM00N's Space Ship": '717176538717749358' + }, + + channels: { + 'neu-support': '714332750156660756', + 'giveaways': '767782084981817344' + }, + + users: { + IRONM00N: '322862723090219008', + Moulberry: '211288288055525376', + nopo: '384620942577369088', + Bestower: '496409778822709251' }, permissions: { diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index 5c98760..995dd82 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -1,6 +1,7 @@ import chalk from 'chalk'; // eslint-disable-next-line @typescript-eslint/no-unused-vars -import { Client, EmbedBuilder, escapeMarkdown, PartialTextBasedChannelFields, type Message } from 'discord.js'; +import { Client, EmbedBuilder, escapeMarkdown, Formatters, PartialTextBasedChannelFields, type Message } from 'discord.js'; +import { stripVTControlCharacters as stripColor } from 'node:util'; import repl, { REPLServer, REPL_MODE_STRICT } from 'repl'; import { WriteStream } from 'tty'; import { type SendMessageType } from '../extensions/discord-akairo/BushClient.js'; @@ -72,16 +73,16 @@ function parseFormatting( discordFormat = false ): string | typeof content { if (typeof content !== 'string') return content; - const newContent: Array<string> = content.split(/<<|>>/); - const tempParsedArray: Array<string> = []; - newContent.forEach((value, index) => { - if (index % 2 !== 0) { - tempParsedArray.push(discordFormat ? `**${escapeMarkdown(value)}**` : color ? chalk[color](value) : value); - } else { - tempParsedArray.push(discordFormat ? escapeMarkdown(value) : value); - } - }); - return tempParsedArray.join(''); + return content + .split(/<<|>>/) + .map((value, index) => { + if (discordFormat) { + return index % 2 === 0 ? escapeMarkdown(value) : Formatters.bold(escapeMarkdown(value)); + } else { + return index % 2 === 0 || !color ? value : chalk[color](value); + } + }) + .join(''); } /** @@ -99,33 +100,24 @@ function inspectContent(content: any, depth = 2, colors = true): string { } /** - * Strips ANSI color codes from a string. - * @param text The string to strip color codes from. - * @returns A string without ANSI color codes. - */ -function stripColor(text: string): string { - return text.replace( - // eslint-disable-next-line no-control-regex - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - '' - ); -} - -/** * Generates a formatted timestamp for logging. * @returns The formatted timestamp. */ function getTimeStamp(): string { const now = new Date(); - const hours = now.getHours(); - const minute = now.getMinutes(); - let hour = hours; - let amOrPm: 'AM' | 'PM' = 'AM'; - if (hour > 12) { - amOrPm = 'PM'; - hour = hour - 12; - } - return `${hour >= 10 ? hour : `0${hour}`}:${minute >= 10 ? minute : `0${minute}`} ${amOrPm}`; + const minute = pad(now.getMinutes()); + const hour = pad(now.getHours() % 12); + const meridiem = now.getHours() > 12 ? 'PM' : 'AM'; + const year = now.getFullYear().toString().slice(2).padStart(2, '0'); + const date = `${pad(now.getMonth() + 1)}/${pad(now.getDay())}/${year}`; + return `${date} ${hour}:${minute} ${meridiem}`; +} + +/** + * Pad a two-digit number. + */ +function pad(num: number) { + return num.toString().padStart(2, '0'); } /** diff --git a/src/lib/utils/BushUtils.ts b/src/lib/utils/BushUtils.ts index 19260c8..af173f9 100644 --- a/src/lib/utils/BushUtils.ts +++ b/src/lib/utils/BushUtils.ts @@ -10,7 +10,7 @@ import { type SlashMessage } from '#lib'; import { humanizeDuration as humanizeDurationMod } from '@notenoughupdates/humanize-duration'; -import assert from 'assert'; +import assert from 'assert/strict'; import cp from 'child_process'; import deepLock from 'deep-lock'; import { Util as AkairoUtil } from 'discord-akairo'; diff --git a/src/listeners/bush/appealListener.ts b/src/listeners/bush/appealListener.ts index 424ee48..cbe62a8 100644 --- a/src/listeners/bush/appealListener.ts +++ b/src/listeners/bush/appealListener.ts @@ -1,5 +1,5 @@ import { BushListener, colors, mappings, ModLog, type BushClientEvents } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { EmbedBuilder } from 'discord.js'; import UserInfoCommand from '../../commands/info/userInfo.js'; import ModlogCommand from '../../commands/moderation/modlog.js'; @@ -14,7 +14,7 @@ export default class AppealListener extends BushListener { } public async exec(...[message]: BushClientEvents['messageCreate']): Promise<any> { - if (!this.client.config.isProduction || !message.inGuild() || message.guildId !== mappings.guilds.bush) return; + if (!this.client.config.isProduction || !message.inGuild() || message.guildId !== mappings.guilds["Moulberry's Bush"]) return; if (message.author.id !== '855446927688335370' || message.embeds.length < 1) return; const userId = message.embeds[0].fields?.find?.((f) => f.name === 'What is your discord ID?')?.value; diff --git a/src/listeners/bush/joinAutoBan.ts b/src/listeners/bush/joinAutoBan.ts index 082a925..4370e86 100644 --- a/src/listeners/bush/joinAutoBan.ts +++ b/src/listeners/bush/joinAutoBan.ts @@ -12,7 +12,7 @@ export default class JoinAutoBanListener extends BushListener { public async exec(...[member]: BushClientEvents['guildMemberAdd']): Promise<void> { if (!this.client.config.isProduction) return; - if (member.guild.id !== mappings.guilds.bush) return; + if (member.guild.id !== mappings.guilds["Moulberry's Bush"]) return; const guild = member.guild; // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/listeners/bush/supportThread.ts b/src/listeners/bush/supportThread.ts index 1dadecb..5145ff2 100644 --- a/src/listeners/bush/supportThread.ts +++ b/src/listeners/bush/supportThread.ts @@ -1,6 +1,6 @@ -import { BushListener, colors, type BushClientEvents } from '#lib'; +import { BushListener, colors, mappings, type BushClientEvents } from '#lib'; import { stripIndent } from '#tags'; -import assert from 'assert'; +import assert from 'assert/strict'; import { EmbedBuilder, MessageType, PermissionFlagsBits, TextChannel } from 'discord.js'; export default class SupportThreadListener extends BushListener { @@ -19,8 +19,8 @@ export default class SupportThreadListener extends BushListener { if (message.author.bot && (message.author.id !== '444871677176709141' || !message.content.includes('uploaded a log,'))) return; - if (message.guild.id !== '516977525906341928') return; // mb - if (message.channel.id !== '714332750156660756') return; // neu-support + if (message.guild.id !== mappings.guilds["Moulberry's Bush"]) return; // mb + if (message.channel.id !== mappings.channels['neu-support']) return; if ( [await message.guild.getSetting('prefix'), `<@!${this.client.user!.id}>`, `<@${this.client.user!.id}>`].some((v) => diff --git a/src/listeners/bush/userUpdateAutoBan.ts b/src/listeners/bush/userUpdateAutoBan.ts index 54051b2..adfb80c 100644 --- a/src/listeners/bush/userUpdateAutoBan.ts +++ b/src/listeners/bush/userUpdateAutoBan.ts @@ -19,7 +19,7 @@ export default class UserUpdateAutoBanListener extends BushListener { if (!code) return; if (eval(code)) { const member = await this.client.guilds.cache - .get(mappings.guilds.bush) + .get(mappings.guilds["Moulberry's Bush"]) ?.members.fetch(newUser.id) .catch(() => undefined); if (!member || !(member instanceof GuildMember)) return; diff --git a/src/listeners/member-custom/bushLevelUpdate.ts b/src/listeners/member-custom/bushLevelUpdate.ts index a9c0820..0281288 100644 --- a/src/listeners/member-custom/bushLevelUpdate.ts +++ b/src/listeners/member-custom/bushLevelUpdate.ts @@ -1,5 +1,5 @@ import { BushListener, format, type BushClientEvents } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { type TextChannel } from 'discord.js'; type Args = BushClientEvents['bushLevelUpdate']; diff --git a/src/listeners/message/quoteCreate.ts b/src/listeners/message/quoteCreate.ts index 0478bcf..166bbb7 100644 --- a/src/listeners/message/quoteCreate.ts +++ b/src/listeners/message/quoteCreate.ts @@ -1,4 +1,4 @@ -import { BushListener, type BushClientEvents } from '#lib'; +import { BushListener, mappings, type BushClientEvents } from '#lib'; export default class QuoteCreateListener extends BushListener { public constructor() { @@ -10,7 +10,7 @@ export default class QuoteCreateListener extends BushListener { } public async exec(...[message]: BushClientEvents['messageCreate']) { - if (message.author.id !== '322862723090219008' || !this.client.config.isProduction) return; + if (message.author.id !== mappings.users['IRONM00N'] || !this.client.config.isProduction) return; if (!message.inGuild()) return; const messages = await this.client.utils.resolveMessagesFromLinks(message.content); diff --git a/src/listeners/ws/INTERACTION_CREATE.ts b/src/listeners/ws/INTERACTION_CREATE.ts index 20c2b3e..67fe56b 100644 --- a/src/listeners/ws/INTERACTION_CREATE.ts +++ b/src/listeners/ws/INTERACTION_CREATE.ts @@ -1,5 +1,5 @@ import { BushListener, capitalize, colors, emojis, Moderation, PunishmentTypePresent } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; import { ActionRowBuilder, ButtonBuilder, diff --git a/src/tasks/cache/updateNeuItemCache.ts b/src/tasks/cache/updateNeuItemCache.ts new file mode 100644 index 0000000..14c107b --- /dev/null +++ b/src/tasks/cache/updateNeuItemCache.ts @@ -0,0 +1,12 @@ +import { BushTask, Time } from '#lib'; + +export default class UpdateNeuItemCache extends BushTask { + public constructor() { + super('updateNeuItemCache', { + delay: 1 * Time.Hour, + runOnStart: true + }); + } + + public async exec() {} +} diff --git a/src/tasks/feature/memberCount.ts b/src/tasks/feature/memberCount.ts index ea422fa..9c31c5b 100644 --- a/src/tasks/feature/memberCount.ts +++ b/src/tasks/feature/memberCount.ts @@ -1,5 +1,5 @@ import { BushTask, MemberCount, Time } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; export default class MemberCountTask extends BushTask { public constructor() { diff --git a/src/tasks/feature/removeExpiredPunishements.ts b/src/tasks/feature/removeExpiredPunishements.ts index 0b20a27..c21454b 100644 --- a/src/tasks/feature/removeExpiredPunishements.ts +++ b/src/tasks/feature/removeExpiredPunishements.ts @@ -1,5 +1,5 @@ import { ActivePunishment, ActivePunishmentType, BushTask, Time } from '#lib'; -import assert from 'assert'; +import assert from 'assert/strict'; const { Op } = (await import('sequelize')).default; export default class RemoveExpiredPunishmentsTask extends BushTask { @@ -0,0 +1,365 @@ +/* eslint-disable */ +// @ts-check + +import { createCanvas, registerFont } from 'canvas'; +import fs from 'fs/promises'; +import path, { dirname, join } from 'path'; +import tinycolor from 'tinycolor2'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +registerFont(join(__dirname, 'assets', 'Faithful.ttf'), { family: 'ComplianceSans' }); +registerFont(join(dirname(fileURLToPath(import.meta.url)), 'assets', 'Roboto-Regular.ttf'), { family: 'Roboto' }); + +/** @typedef {string} McItemId */ +/** @typedef {string} SbItemId */ +/** @typedef {string} MojangJson */ +/** @typedef {`${SbItemId}:${number}` | ''} SbRecipeItem */ +/** @typedef {{[Location in `${'A' | 'B' | 'C'}${1 | 2 | 3}`]: SbRecipeItem;}} SbRecipe */ +/** @typedef {'WIKI_URL' | ''} InfoType */ +/** @typedef {`${'WOLF' | 'BLAZE' | 'EMAN'}_${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`} Slayer */ +/** @typedef {'0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|'a'|'b'|'c'|'d'|'e'|'f'} code */ +/** + * @typedef RawNeuItem + * @property {McItemId} itemid + * @property {string} displayname + * @property {MojangJson} nbttag + * @property {number} damage + * @property {string[]} lore + * @property {SbRecipe} [recipe] + * @property {SbItemId} internalname + * @property {InfoType} infoType + * @property {string[]} [info] + * @property {string} crafttext + * @property {boolean} [vanilla] + * @property {boolean} [useneucraft] + * @property {Slayer} [slayer_req] + * @property {string} [clickcommand] + * @property {number} [x] + * @property {number} [y] + * @property {number} [z] + * @property {string} [island] + * @property {{ type: string; cost: any[]; result: SbItemId }[]} [recipes] + * @property {SbItemId} [parent] + * @property {boolean} [noseal] + */ + +const FormattingCodes = { + Black: '§0', + DarkBlue: '§1', + DarkGreen: '§2', + DarkAqua: '§3', + DarkRed: '§4', + DarkPurple: '§5', + Gold: '§6', + Gray: '§7', + DarkGray: '§8', + Blue: '§9', + Green: '§a', + Aqua: '§b', + Red: '§c', + LightPurple: '§d', + Yellow: '§e', + White: '§f', + + Obfuscated: '§k', + Bold: '§l', + Strikethrough: '§m', + Underline: '§n', + Italic: '§o', + Reset: '§r' +}; + +const formattingInfo = { + [FormattingCodes.Black]: { + foreground: 'rgb(0, 0, 0)', + foregroundDarker: 'rgb(0, 0, 0)', + background: 'rgb(0, 0, 0)', + backgroundDarker: 'rgb(0, 0, 0)', + ansi: '\u001b[0;30m' + }, + [FormattingCodes.DarkBlue]: { + foreground: 'rgb(0, 0, 170)', + foregroundDarker: 'rgb(0, 0, 118)', + background: 'rgb(0, 0, 42)', + backgroundDarker: 'rgb(0, 0, 29)', + ansi: '\u001b[0;34m' + }, + [FormattingCodes.DarkGreen]: { + foreground: 'rgb(0, 170, 0)', + foregroundDarker: 'rgb(0, 118, 0)', + background: 'rgb(0, 42, 0)', + backgroundDarker: 'rgb(0, 29, 0)', + ansi: '\u001b[0;32m' + }, + [FormattingCodes.DarkAqua]: { + foreground: 'rgb(0, 170, 170)', + foregroundDarker: 'rgb(0, 118, 118)', + background: 'rgb(0, 42, 42)', + backgroundDarker: 'rgb(0, 29, 29)', + ansi: '\u001b[0;36m' + }, + [FormattingCodes.DarkRed]: { + foreground: 'rgb(170, 0, 0)', + foregroundDarker: 'rgb(118, 0, 0)', + background: 'rgb(42, 0, 0)', + backgroundDarker: 'rgb(29, 0, 0)', + ansi: '\u001b[0;31m' + }, + [FormattingCodes.DarkPurple]: { + foreground: 'rgb(170, 0, 170)', + foregroundDarker: 'rgb(118, 0, 118)', + background: 'rgb(42, 0, 42)', + backgroundDarker: 'rgb(29, 0, 29)', + ansi: '\u001b[0;35m' + }, + [FormattingCodes.Gold]: { + foreground: 'rgb(255, 170, 0)', + foregroundDarker: 'rgb(178, 118, 0)', + background: 'rgb(42, 42, 0)', + backgroundDarker: 'rgb(29, 29, 0)', + ansi: '\u001b[0;33m' + }, + [FormattingCodes.Gray]: { + foreground: 'rgb(170, 170, 170)', + foregroundDarker: 'rgb(118, 118, 118)', + background: 'rgb(42, 42, 42)', + backgroundDarker: 'rgb(29, 29, 29)', + ansi: '\u001b[0;37m' + }, + [FormattingCodes.DarkGray]: { + foreground: 'rgb(85, 85, 85)', + foregroundDarker: 'rgb(59, 59, 59)', + background: 'rgb(21, 21, 21)', + backgroundDarker: 'rgb(14, 14, 14)', + ansi: '\u001b[0;90m' + }, + [FormattingCodes.Blue]: { + foreground: 'rgb(85, 85, 255)', + foregroundDarker: 'rgb(59, 59, 178)', + background: 'rgb(21, 21, 63)', + backgroundDarker: 'rgb(14, 14, 44)', + ansi: '\u001b[0;94m' + }, + [FormattingCodes.Green]: { + foreground: 'rgb(85, 255, 85)', + foregroundDarker: 'rgb(59, 178, 59)', + background: 'rgb(21, 63, 21)', + backgroundDarker: 'rgb(14, 44, 14)', + ansi: '\u001b[0;92m' + }, + [FormattingCodes.Aqua]: { + foreground: 'rgb(85, 255, 255)', + foregroundDarker: 'rgb(59, 178, 178)', + background: 'rgb(21, 63, 63)', + backgroundDarker: 'rgb(14, 44, 44)', + ansi: '\u001b[0;96m' + }, + [FormattingCodes.Red]: { + foreground: 'rgb(255, 85, 85)', + foregroundDarker: 'rgb(178, 59, 59)', + background: 'rgb(63, 21, 21)', + backgroundDarker: 'rgb(44, 14, 14)', + ansi: '\u001b[0;91m' + }, + [FormattingCodes.LightPurple]: { + foreground: 'rgb(255, 85, 255)', + foregroundDarker: 'rgb(178, 59, 178)', + background: 'rgb(63, 21, 63)', + backgroundDarker: 'rgb(44, 14, 44)', + ansi: '\u001b[0;95m' + }, + [FormattingCodes.Yellow]: { + foreground: 'rgb(255, 255, 85)', + foregroundDarker: 'rgb(178, 178, 59)', + background: 'rgb(63, 63, 21)', + backgroundDarker: 'rgb(44, 44, 14)', + ansi: '\u001b[0;93m' + }, + [FormattingCodes.White]: { + foreground: 'rgb(255, 255, 255)', + foregroundDarker: 'rgb(178, 178, 178)', + background: 'rgb(63, 63, 63)', + backgroundDarker: 'rgb(44, 44, 44)', + ansi: '\u001b[0;97m' + }, + + [FormattingCodes.Obfuscated]: { ansi: '\u001b[8m' }, + [FormattingCodes.Bold]: { ansi: '\u001b[1m' }, + [FormattingCodes.Strikethrough]: { ansi: '\u001b[9m' }, + [FormattingCodes.Underline]: { ansi: '\u001b[4m' }, + [FormattingCodes.Italic]: { ansi: '\u001b[3m' }, + [FormattingCodes.Reset]: { ansi: '\u001b[0m' } +}; + +/** + * stolen from NEU + * @param {string} displayname + * @returns {code} + */ +function getPrimaryColourCode(displayname) { + let lastColourCode = -99; + let currentColour = 0; + const mostCommon = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (let i = 0; i < displayname.length; i++) { + const c = displayname.charAt(i); + if (c === '\u00A7') { + lastColourCode = i; + } else if (lastColourCode === i - 1) { + const colIndex = '0123456789abcdef'.indexOf(c); + if (colIndex >= 0) { + currentColour = colIndex; + } else { + currentColour = 0; + } + } else if ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.indexOf(c) >= 0) { + if (currentColour > 0) { + mostCommon[currentColour] = mostCommon[currentColour]++; + } + } + } + let mostCommonCount = 0; + for (let index = 0; index < mostCommon.length; index++) { + if (mostCommon[index] > mostCommonCount) { + mostCommonCount = mostCommon[index]; + currentColour = index; + } + } + + /** @type {code} */ + // @ts-ignore + const code = '0123456789abcdef'.charAt(currentColour); + return code; +} + +/** + * @param {number} decimal + */ +function decimalToHex(decimal) { + return decimal.toString(16).padStart(6, '0'); +} + +/** + * @param {RawNeuItem} item + * @returns {Buffer} + */ +function tooltip(item) { + const background = '#100010'; + + const width = 1920; + const height = 1080; + const scale = 10; + + const itemRender = createCanvas(width, height), + ctx = itemRender.getContext('2d'); + + // ctx.fillStyle = '#000'; + // ctx.fillRect(0, 0, width, height); + + // ctx.globalAlpha = 0.94; + ctx.fillStyle = background; + + // top outside + ctx.fillRect(scale, 0, width - 2 * scale, scale); + + // bottom outside + ctx.fillRect(scale, height - scale, width - 2 * scale, scale); + + // left outside + ctx.fillRect(0, scale, scale, height - 2 * scale); + + // right outside + ctx.fillRect(width - scale, scale, scale, height - 2 * scale); + + // middle + ctx.fillRect(2 * scale, 2 * scale, width - 4 * scale, height - 4 * scale); + + // ctx.globalAlpha = 0.78; + + const borderColorStart = parseInt(new tinycolor(getPrimaryColour(item.displayname)).toHex(), 16); + const borderColorEnd = ((borderColorStart & 0xfefefe) >> 1) | (borderColorStart & 0xff000000); + + const borderColorStartStr = `#${decimalToHex(borderColorStart)}`; + const borderColorEndStr = `#${decimalToHex(borderColorEnd)}`; + + console.log(borderColorStartStr, borderColorEndStr); + + ctx.fillStyle = borderColorStartStr; + + // top highlight + ctx.fillRect(scale, scale, width - 2 * scale, scale); + + // left highlight + ctx.fillRect(scale, 2 * scale, scale, height - 3 * scale); + + // bottom highlight + { + const x = 2 * scale, + y = height - 2 * scale, + w = width - 3 * scale, + h = scale; + const gradient = ctx.createLinearGradient(x, y, x + w, y + h); + gradient.addColorStop(0, borderColorStartStr); + gradient.addColorStop(1, borderColorEndStr); + ctx.fillStyle = gradient; + + ctx.fillRect(x, y, w, h); + } + + // right highlight + { + const x = width - 2 * scale, + y = 2 * scale, + w = scale, + h = height - 4 * scale; + const gradient = ctx.createLinearGradient(x, y, x + w, y + h); + gradient.addColorStop(0, borderColorStartStr); + gradient.addColorStop(1, borderColorEndStr); + ctx.fillStyle = gradient; + + ctx.fillRect(x, y, w, h); + } + + ctx.font = `50px ComplianceSans`; + ctx.fillText(stripCodes(item.displayname), scale * 4, scale * 7); + + for (let i = 0; i < item.lore.length; i++) { + const line = item.lore[i]; + + ctx.fillStyle = `#${decimalToHex(parseInt(new tinycolor(getPrimaryColour(line)).toHex(), 16))}`; + ctx.fillText(stripCodes(line), scale * 4, scale * (7 + (i + 1) * 5)); + } + + return itemRender.toBuffer('image/png'); +} + +/** + * @param {string} displayname + */ +function getPrimaryColour(displayname) { + const code = getPrimaryColourCode(displayname); + return formattingInfo[`§${code}`].foregroundDarker; +} + +/** + * @param {string} str + * @returns {string} + */ +function stripCodes(str) { + for (const format in formattingInfo) { + // @ts-ignore + str = str.replaceAll(new RegExp(format, 'ig'), ''); + } + return str; +} + +const repo = path.join(__dirname, 'neu-item-repo-dangerous'); +const itemPath = path.join(repo, 'items'); +const items = await fs.readdir(itemPath); + +const randomItem = items[Math.floor(Math.random() * items.length)]; +/** @type {RawNeuItem} */ +const item = (await import(path.join(itemPath, randomItem), { assert: { type: 'json' } })).default; + +console.log(randomItem); +fs.writeFile('./test.png', tooltip(item)); diff --git a/test.png b/test.png Binary files differnew file mode 100644 index 0000000..942a85e --- /dev/null +++ b/test.png diff --git a/tooltips.nnb b/tooltips.nnb new file mode 100644 index 0000000..6e36999 --- /dev/null +++ b/tooltips.nnb @@ -0,0 +1,118 @@ +{ + "cells": [ + { + "language": "markdown", + "source": [ + "# Thingy" + ], + "outputs": [] + }, + { + "language": "typescript", + "source": [ + "function drawGradientRect(\n\tzLevel: number,\n\tleft: number,\n\ttop: number,\n\tright: number,\n\tbottom: number,\n\tstartColor: number,\n\tendColor: number\n) {\n\tconst startAlpha = ((startColor >> 24) & 255) / 255.0;\n\tconst startRed = ((startColor >> 16) & 255) / 255.0;\n\tconst startGreen = ((startColor >> 8) & 255) / 255.0;\n\tconst startBlue = (startColor & 255) / 255.0;\n\tconst endAlpha = ((endColor >> 24) & 255) / 255.0;\n\tconst endRed = ((endColor >> 16) & 255) / 255.0;\n\tconst endGreen = ((endColor >> 8) & 255) / 255.0;\n\tconst endBlue = (endColor & 255) / 255.0;\n\n\tconsole.dir({ startAlpha, startRed, startGreen, startBlue, endAlpha, endRed, endGreen, endBlue });\n\tconsole.dir({\n\t\tstartAlpha: color(startAlpha),\n\t\tstartRed: color(startRed),\n\t\tstartGreen: color(startGreen),\n\t\tstartBlue: color(startBlue),\n\t\tendAlpha: color(endAlpha),\n\t\tendRed: color(endRed),\n\t\tendGreen: color(endGreen),\n\t\tendBlue: color(endBlue)\n\t});\n}\n\nfunction color(num: number) {\n\treturn Math.floor(num * 255);\n}\n\nconst zLevel = 300;\nconst backgroundColor = 0xF0100010;\ndrawGradientRect(\n zLevel,\n 0,\n 0,\n 0,\n 0,\n backgroundColor,\n backgroundColor\n);" + ], + "outputs": [ + { + "items": [ + { + "mime": "application/vnd.code.notebook.stdout", + "value": [ + "{", + " startAlpha: 0.9411764705882353,", + " startRed: 0.06274509803921569,", + " startGreen: 0,", + " startBlue: 0.06274509803921569,", + " endAlpha: 0.9411764705882353,", + " endRed: 0.06274509803921569,", + " endGreen: 0,", + " endBlue: 0.06274509803921569", + "}", + "{", + " startAlpha: 240,", + " startRed: 16,", + " startGreen: 0,", + " startBlue: 16,", + " endAlpha: 240,", + " endRed: 16,", + " endGreen: 0,", + " endBlue: 16", + "}", + "" + ] + } + ] + } + ] + }, + { + "language": "markdown", + "source": [ + "# Thingy 2" + ], + "outputs": [] + }, + { + "language": "typescript", + "source": [ + "enum FormattingCodes {\n\tBlack = '§0',\n\tDarkBlue = '§1',\n\tDarkGreen = '§2',\n\tDarkAqua = '§3',\n\tDarkRed = '§4',\n\tDarkPurple = '§5',\n\tGold = '§6',\n\tGray = '§7',\n\tDarkGray = '§8',\n\tBlue = '§9',\n\tGreen = '§a',\n\tAqua = '§b',\n\tRed = '§c',\n\tLightPurple = '§d',\n\tYellow = '§e',\n\tWhite = '§f',\n\n\tObfuscated = '§k',\n\tBold = '§l',\n\tStrikethrough = '§m',\n\tUnderline = '§n',\n\tItalic = '§o',\n\tReset = '§r'\n}\n\nconst formattingInfo = {\n\t[FormattingCodes.Black]: {\n\t\tforeground: 'rgb(0, 0, 0)',\n\t\tforegroundDarker: 'rgb(0, 0, 0)',\n\t\tbackground: 'rgb(0, 0, 0)',\n\t\tbackgroundDarker: 'rgb(0, 0, 0)',\n\t\tansi: '\\u001b[0;30m'\n\t},\n\t[FormattingCodes.DarkBlue]: {\n\t\tforeground: 'rgb(0, 0, 170)',\n\t\tforegroundDarker: 'rgb(0, 0, 118)',\n\t\tbackground: 'rgb(0, 0, 42)',\n\t\tbackgroundDarker: 'rgb(0, 0, 29)',\n\t\tansi: '\\u001b[0;34m'\n\t},\n\t[FormattingCodes.DarkGreen]: {\n\t\tforeground: 'rgb(0, 170, 0)',\n\t\tforegroundDarker: 'rgb(0, 118, 0)',\n\t\tbackground: 'rgb(0, 42, 0)',\n\t\tbackgroundDarker: 'rgb(0, 29, 0)',\n\t\tansi: '\\u001b[0;32m'\n\t},\n\t[FormattingCodes.DarkAqua]: {\n\t\tforeground: 'rgb(0, 170, 170)',\n\t\tforegroundDarker: 'rgb(0, 118, 118)',\n\t\tbackground: 'rgb(0, 42, 42)',\n\t\tbackgroundDarker: 'rgb(0, 29, 29)',\n\t\tansi: '\\u001b[0;36m'\n\t},\n\t[FormattingCodes.DarkRed]: {\n\t\tforeground: 'rgb(170, 0, 0)',\n\t\tforegroundDarker: 'rgb(118, 0, 0)',\n\t\tbackground: 'rgb(42, 0, 0)',\n\t\tbackgroundDarker: 'rgb(29, 0, 0)',\n\t\tansi: '\\u001b[0;31m'\n\t},\n\t[FormattingCodes.DarkPurple]: {\n\t\tforeground: 'rgb(170, 0, 170)',\n\t\tforegroundDarker: 'rgb(118, 0, 118)',\n\t\tbackground: 'rgb(42, 0, 42)',\n\t\tbackgroundDarker: 'rgb(29, 0, 29)',\n\t\tansi: '\\u001b[0;35m'\n\t},\n\t[FormattingCodes.Gold]: {\n\t\tforeground: 'rgb(255, 170, 0)',\n\t\tforegroundDarker: 'rgb(178, 118, 0)',\n\t\tbackground: 'rgb(42, 42, 0)',\n\t\tbackgroundDarker: 'rgb(29, 29, 0)',\n\t\tansi: '\\u001b[0;33m'\n\t},\n\t[FormattingCodes.Gray]: {\n\t\tforeground: 'rgb(170, 170, 170)',\n\t\tforegroundDarker: 'rgb(118, 118, 118)',\n\t\tbackground: 'rgb(42, 42, 42)',\n\t\tbackgroundDarker: 'rgb(29, 29, 29)',\n\t\tansi: '\\u001b[0;37m'\n\t},\n\t[FormattingCodes.DarkGray]: {\n\t\tforeground: 'rgb(85, 85, 85)',\n\t\tforegroundDarker: 'rgb(59, 59, 59)',\n\t\tbackground: 'rgb(21, 21, 21)',\n\t\tbackgroundDarker: 'rgb(14, 14, 14)',\n\t\tansi: '\\u001b[0;90m'\n\t},\n\t[FormattingCodes.Blue]: {\n\t\tforeground: 'rgb(85, 85, 255)',\n\t\tforegroundDarker: 'rgb(59, 59, 178)',\n\t\tbackground: 'rgb(21, 21, 63)',\n\t\tbackgroundDarker: 'rgb(14, 14, 44)',\n\t\tansi: '\\u001b[0;94m'\n\t},\n\t[FormattingCodes.Green]: {\n\t\tforeground: 'rgb(85, 255, 85)',\n\t\tforegroundDarker: 'rgb(59, 178, 59)',\n\t\tbackground: 'rgb(21, 63, 21)',\n\t\tbackgroundDarker: 'rgb(14, 44, 14)',\n\t\tansi: '\\u001b[0;92m'\n\t},\n\t[FormattingCodes.Aqua]: {\n\t\tforeground: 'rgb(85, 255, 255)',\n\t\tforegroundDarker: 'rgb(59, 178, 178)',\n\t\tbackground: 'rgb(21, 63, 63)',\n\t\tbackgroundDarker: 'rgb(14, 44, 44)',\n\t\tansi: '\\u001b[0;96m'\n\t},\n\t[FormattingCodes.Red]: {\n\t\tforeground: 'rgb(255, 85, 85)',\n\t\tforegroundDarker: 'rgb(178, 59, 59)',\n\t\tbackground: 'rgb(63, 21, 21)',\n\t\tbackgroundDarker: 'rgb(44, 14, 14)',\n\t\tansi: '\\u001b[0;91m'\n\t},\n\t[FormattingCodes.LightPurple]: {\n\t\tforeground: 'rgb(255, 85, 255)',\n\t\tforegroundDarker: 'rgb(178, 59, 178)',\n\t\tbackground: 'rgb(63, 21, 63)',\n\t\tbackgroundDarker: 'rgb(44, 14, 44)',\n\t\tansi: '\\u001b[0;95m'\n\t},\n\t[FormattingCodes.Yellow]: {\n\t\tforeground: 'rgb(255, 255, 85)',\n\t\tforegroundDarker: 'rgb(178, 178, 59)',\n\t\tbackground: 'rgb(63, 63, 21)',\n\t\tbackgroundDarker: 'rgb(44, 44, 14)',\n\t\tansi: '\\u001b[0;93m'\n\t},\n\t[FormattingCodes.White]: {\n\t\tforeground: 'rgb(255, 255, 255)',\n\t\tforegroundDarker: 'rgb(178, 178, 178)',\n\t\tbackground: 'rgb(63, 63, 63)',\n\t\tbackgroundDarker: 'rgb(44, 44, 44)',\n\t\tansi: '\\u001b[0;97m'\n\t},\n\n\t[FormattingCodes.Obfuscated]: { ansi: '\\u001b[8m' },\n\t[FormattingCodes.Bold]: { ansi: '\\u001b[1m' },\n\t[FormattingCodes.Strikethrough]: { ansi: '\\u001b[9m' },\n\t[FormattingCodes.Underline]: { ansi: '\\u001b[4m' },\n\t[FormattingCodes.Italic]: { ansi: '\\u001b[3m' },\n\t[FormattingCodes.Reset]: { ansi: '\\u001b[0m' }\n} as const;" + ], + "outputs": [] + }, + { + "language": "markdown", + "source": [ + "# Thingy 3" + ], + "outputs": [] + }, + { + "language": "typescript", + "source": [ + "type code = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f';\n\n// stolen from NEU\nfunction getPrimaryColourCode(displayname: string): code {\n\tlet lastColourCode = -99;\n\tlet currentColour = 0;\n\tconst mostCommon = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\tfor (let i = 0; i < displayname.length; i++) {\n\t\tconst c = displayname.charAt(i);\n\t\tif (c === '\\u00A7') {\n\t\t\tlastColourCode = i;\n\t\t} else if (lastColourCode === i - 1) {\n\t\t\tconst colIndex = '0123456789abcdef'.indexOf(c);\n\t\t\tif (colIndex >= 0) {\n\t\t\t\tcurrentColour = colIndex;\n\t\t\t} else {\n\t\t\t\tcurrentColour = 0;\n\t\t\t}\n\t\t} else if ('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.indexOf(c) >= 0) {\n\t\t\tif (currentColour > 0) {\n\t\t\t\tmostCommon[currentColour] = mostCommon[currentColour]++;\n\t\t\t}\n\t\t}\n\t}\n\tlet mostCommonCount = 0;\n\tfor (let index = 0; index < mostCommon.length; index++) {\n\t\tif (mostCommon[index] > mostCommonCount) {\n\t\t\tmostCommonCount = mostCommon[index];\n\t\t\tcurrentColour = index;\n\t\t}\n\t}\n\n\treturn <code>'0123456789abcdef'.charAt(currentColour);\n}\n\nfunction getPrimaryColour(displayname: string) {\n\tconst code = getPrimaryColourCode(displayname);\n\treturn formattingInfo[`§${code}`].foregroundDarker;\n}\n\nfunction stripCodes(str: string) {\n\tfor (const format in formattingInfo) {\n\t\tstr = str.replaceAll(format, '');\n\t}\n\treturn str;\n}\n" + ], + "outputs": [] + }, + { + "language": "markdown", + "source": [ + "# Thingy 4" + ], + "outputs": [] + }, + { + "language": "typescript", + "source": [ + "import tinycolor from 'tinycolor2';\nimport canvas from 'canvas';\nimport path from 'path';\n\ntype McItemId = Lowercase<string>;\ntype SbItemId = Uppercase<string>;\ntype MojangJson = string;\ntype SbRecipeItem = `${SbItemId}:${number}` | '';\ntype SbRecipe = {\n\t[Location in `${'A' | 'B' | 'C'}${1 | 2 | 3}`]: SbRecipeItem;\n};\ntype InfoType = 'WIKI_URL' | '';\ntype Slayer = `${'WOLF' | 'BLAZE' | 'EMAN'}_${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}`;\ninterface RawNeuItem {\n\titemid: McItemId;\n\tdisplayname: string;\n\tnbttag: MojangJson;\n\tdamage: number;\n\tlore: string[];\n\trecipe?: SbRecipe;\n\tinternalname: SbItemId;\n\tmodver: string;\n\tinfoType: InfoType;\n\tinfo?: string[];\n\tcrafttext: string;\n\tvanilla?: boolean;\n\tuseneucraft?: boolean;\n\tslayer_req?: Slayer;\n\tclickcommand?: string;\n\tx?: number;\n\ty?: number;\n\tz?: number;\n\tisland?: string;\n\trecipes?: { type: string; cost: any[]; result: SbItemId }[];\n\t/** @deprecated */\n\tparent?: SbItemId;\n\tnoseal?: boolean;\n}\n\nfunction tooltip(item: RawNeuItem) {\n\tconst background = '#100010';\n\n\tconst width = 1000;\n\tconst height = 250;\n\tconst scale = 10;\n\n\tcanvas.registerFont(path.join(__dirname, 'assets', 'Faithful.ttf'), { family: 'Compliance Sans' });\n\tcanvas.registerFont(path.join(__dirname, 'assets', 'Roboto-Regular.ttf'), { family: 'Roboto' });\n\n\tconst itemRender = canvas.createCanvas(width, height),\n\t\tctx = itemRender.getContext('2d');\n\n\tctx.globalAlpha = 0.94;\n\tctx.fillStyle = background;\n\n\t// top outside\n\tctx.fillRect(scale, 0, width - 2 * scale, scale);\n\n\t// bottom outside\n\tctx.fillRect(scale, height - scale, width - 2 * scale, scale);\n\n\t// left outside\n\tctx.fillRect(0, scale, scale, height - 2 * scale);\n\n\t// right outside\n\tctx.fillRect(width - scale, scale, scale, height - 2 * scale);\n\n\t// middle\n\tctx.fillRect(2 * scale, 2 * scale, width - 4 * scale, height - 4 * scale);\n\n\tctx.globalAlpha = 0.78;\n\n\tconst borderColorStart = parseInt(new tinycolor(getPrimaryColour(item.displayname)).toHex(), 16);\n\tconst borderColorEnd = ((borderColorStart & 0xfefefe) >> 1) | (borderColorStart & 0xff000000);\n\n\tconst borderColorStartStr = `#${borderColorStart.toString(16)}`;\n\tconst borderColorEndStr = `#${borderColorEnd.toString(16)}`;\n\n\tctx.fillStyle = borderColorStartStr;\n\n\t// top highlight\n\tctx.fillRect(scale, scale, width - 2 * scale, scale);\n\n\t// left highlight\n\tctx.fillRect(scale, 2 * scale, scale, height - 3 * scale);\n\n\t// bottom highlight\n\t{\n\t\tconst x = 2 * scale,\n\t\t\ty = height - 2 * scale,\n\t\t\tw = width - 3 * scale,\n\t\t\th = scale;\n\t\tconst gradient = ctx.createLinearGradient(x, y, x + w, y + h);\n\t\tgradient.addColorStop(0, borderColorStartStr);\n\t\tgradient.addColorStop(1, borderColorEndStr);\n\t\tctx.fillStyle = gradient;\n\n\t\tctx.fillRect(x, y, w, h);\n\t}\n\n\t// right highlight\n\t{\n\t\tconst x = width - 2 * scale,\n\t\t\ty = 2 * scale,\n\t\t\tw = scale,\n\t\t\th = height - 4 * scale;\n\t\tconst gradient = ctx.createLinearGradient(x, y, x + w, y + h);\n\t\tgradient.addColorStop(0, borderColorStartStr);\n\t\tgradient.addColorStop(1, borderColorEndStr);\n\t\tctx.fillStyle = gradient;\n\n\t\tctx.fillRect(x, y, w, h);\n\t}\n\n\tctx.font = `48px Roboto`;\n\tctx.fillText(stripCodes(item.displayname), scale * 4, scale * 7);\n\n\tconst buf = itemRender.toBuffer();\n\treturn buf;\n}\n" + ], + "outputs": [] + }, + { + "language": "typescript", + "source": [ + "import fs from 'fs/promises';\nimport path from 'path';\n\nconst repo = path.join(__dirname, 'neu-item-repo-dangerous');\nconst itemPath = path.join(repo, 'items');\nconst items = await fs.readdir(itemPath);\n\nconst randomItem = items[Math.floor(Math.random() * items.length)];\nconst item = (await import(path.join(itemPath, randomItem), { assert: { type: 'json' } })).default as RawNeuItem;\n\nconsole.log(stripCodes(item.displayname));\ntooltip(item);\n" + ], + "outputs": [ + { + "items": [ + { + "mime": "application/vnd.code.notebook.stdout", + "value": [ + "Enderman Minion IV", + "" + ] + } + ] + }, + { + "items": [ + { + "mime": "image/png", + "value": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAAD6CAYAAAAyVW3pAAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nO3daZAkaX3f8efJoyqzju7qY3q659je7tnZnZ1ddlmWJWSWsBEskgOQhfElwMIYAmNH6JXDjvBLXtt+Y4etCFsOh7yBQbIt2QohWSCMEIhjEQgWWPaaa+fqnpk+q6orq7Iy8/GLmu6uI6urKiu7O6vm+4noiN2eOvKorH5++fyf55GiTwVR2Or3sQAAAAAAoGFLbBX6eZx22BsCAAAAAAB6I6ADAAAAAJAABHQAAAAAABKAgA4AAAAAQAIQ0AEAAAAASAACOgAAAAAACUBABwAAAAAgAQjoAAAAAAAkAAEdAAAAAIAEMAqisNXPA594/sVXD3tjAAAAAAAYN698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R0AAAAAgIiCGDM6Je4AAAAAAEQQZzgXgh50AAAAAAAiYhZ3AAAAAADGDgEdAAAAAIAEoMQdAAAAAIBIKHEHAAAAAGDsENABAAAAAEiA2Evcn3j+xVc7fxu123//eWqgl4g61/1w2zn4FPtHv52DHcdh3y/K/jXea/DtPMptbLzf0R7L6PsXbemHo91OpY7nmh34WdFOujjKa71xvo/+czbwO6lh3u9otnP/dB/1dg72vP3tTO511Po9lMzt7Ly8k3m9j8J2hv/dSd71Ht+xPMptHOb9Du954duZrGu9e3soWddQ96ZGcrbz4OZQcq6jg9vAydnOdvSgAwAAAACQAAR0HJKod+sAAACGQRsEwOgioAMAAAAAkAAEdAAAAAAAEoCAjh7iXdcPAACgP7RBADx4RiKgR544GQAAAACAETESAR1x4C4HAAA4DrRBAKBfBHQAAAAAABKAgA4AwIhiCBgAAONF9vvAgihsHeaGAAAAAAAwjrbEVqGfx9GDDgAAAABAAhDQAQAAAABIAAI6AAAAAAAJQEAHAAAAACABCOgAAAAAACQAAR0AAAAAgAQgoAMAAAAAkAAEdAAAAAAAEoCADgAAAABAAvx/698dMJgpvRYAAAAASUVORK5CYII=" + } + ] + } + ] + } + ] +}
\ No newline at end of file diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json new file mode 100644 index 0000000..59f6ecc --- /dev/null +++ b/tsconfig.eslint.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "include": [ + "src/**/*.ts", + "src/**/*d.ts", + "lib/**/*.ts", + "ecosystem.config.cjs", + ".eslintrc.cjs", + "config/**/*.ts", + "tests/**/*.ts", + "vite.config.ts", + "tooltips*", + "test*" + ] +} diff --git a/tsconfig.json b/tsconfig.json index eb23517..6d24566 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,15 +27,6 @@ "#tags": ["./src/lib/common/tags.js"] } }, - "include": [ - "src/**/*.ts", - "src/**/*d.ts", - "lib/**/*.ts", - "ecosystem.config.cjs", - ".eslintrc.cjs", - "config/**/*.ts", - "tests/**/*.ts", - "vite.config.ts" - ], + "include": ["src/**/*.ts", "src/**/*d.ts", "lib/**/*.ts", "test.js"], "exclude": ["dist", "node_modules"] } diff --git a/vite.config.ts b/vite.config.ts index 58e1d1c..5bb079e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,9 @@ -import { defineConfig } from 'vitest/config'; +// import { defineConfig } from 'vitest/config'; -export default defineConfig({ - test: { - include: ['./tests/**/*.test.ts'] - } -}); +// export default defineConfig({ +// test: { +// include: ['./tests/**/*.test.ts'] +// } +// }); + +export {}; @@ -5,7 +5,7 @@ __metadata: version: 6 cacheKey: 8 -"@babel/runtime@npm:^7.18.6": +"@babel/runtime@npm:^7.18.9": version: 7.18.9 resolution: "@babel/runtime@npm:7.18.9" dependencies: @@ -14,21 +14,7 @@ __metadata: languageName: node linkType: hard -"@discordjs/builders@npm:^0.15.0": - version: 0.15.0 - resolution: "@discordjs/builders@npm:0.15.0" - dependencies: - "@sapphire/shapeshift": ^3.1.0 - "@sindresorhus/is": ^4.6.0 - discord-api-types: ^0.33.3 - fast-deep-equal: ^3.1.3 - ts-mixer: ^6.0.1 - tslib: ^2.4.0 - checksum: 1a8a4ffe048243ebb9fbbc76a113e4994c68904a5b3d256a6b10c0123f1d0fb58b45809d134ba993293fb2190c9f3506663ddfb5068a86ec6b9c53b5db61f6a6 - languageName: node - linkType: hard - -"@discordjs/builders@npm:^1.0.0": +"@discordjs/builders@npm:^1.0.0, @discordjs/builders@npm:^1.1.0": version: 1.1.0 resolution: "@discordjs/builders@npm:1.1.0" dependencies: @@ -41,13 +27,6 @@ __metadata: languageName: node linkType: hard -"@discordjs/collection@npm:^0.7.0": - version: 0.7.0 - resolution: "@discordjs/collection@npm:0.7.0" - checksum: 141aa35a5433bacba3617b533557b4948388c7b59cdaecee51ccd721c1b9242e50d95bdef53ee2491535a017095f5072ace3c3e9e594193f67a1c5a8a4b7db93 - languageName: node - linkType: hard - "@discordjs/collection@npm:^1.0.0, @discordjs/collection@npm:^1.0.1": version: 1.0.1 resolution: "@discordjs/collection@npm:1.0.1" @@ -55,21 +34,7 @@ __metadata: languageName: node linkType: hard -"@discordjs/rest@npm:^0.5.0": - version: 0.5.0 - resolution: "@discordjs/rest@npm:0.5.0" - dependencies: - "@discordjs/collection": ^0.7.0 - "@sapphire/async-queue": ^1.3.1 - "@sapphire/snowflake": ^3.2.2 - discord-api-types: ^0.33.3 - tslib: ^2.4.0 - undici: ^5.4.0 - checksum: 36427fd77ff11285da4400e9960fccb71aafa657e43c3de4fe4772d1497f20c3d84754c844ad44d2c6f68fed45303ace790191fd811c94414312fde20d0346c2 - languageName: node - linkType: hard - -"@discordjs/rest@npm:^1.0.0": +"@discordjs/rest@npm:^1.0.0, @discordjs/rest@npm:^1.0.1": version: 1.0.1 resolution: "@discordjs/rest@npm:1.0.1" dependencies: @@ -84,6 +49,28 @@ __metadata: languageName: node linkType: hard +"@electron/get@npm:^1.14.1": + version: 1.14.1 + resolution: "@electron/get@npm:1.14.1" + dependencies: + debug: ^4.1.1 + env-paths: ^2.2.0 + fs-extra: ^8.1.0 + global-agent: ^3.0.0 + global-tunnel-ng: ^2.7.1 + got: ^9.6.0 + progress: ^2.0.3 + semver: ^6.2.0 + sumchecker: ^3.0.1 + dependenciesMeta: + global-agent: + optional: true + global-tunnel-ng: + optional: true + checksum: 21fec5e82bbee8f9fa183b46e05675b137c3130c7999d3b2b34a0047d1a06ec3c76347b9bbdb9911ba9b2123697804e360a15dda9db614c0226d5d4dcc4d6d15 + languageName: node + linkType: hard + "@esbuild/linux-loong64@npm:0.14.53": version: 0.14.53 resolution: "@esbuild/linux-loong64@npm:0.14.53" @@ -140,6 +127,13 @@ __metadata: languageName: node linkType: hard +"@ironm00n/nbt-ts@npm:^1.4.0": + version: 1.4.0 + resolution: "@ironm00n/nbt-ts@npm:1.4.0" + checksum: c518403b261668fe077b2e202acb6b9c597cdefc4453d5a13fee40dc90dadc1c8e651b47f7ac1e3036b317d7a1998428a69762552179815c57923175c538bbb1 + languageName: node + linkType: hard + "@mapbox/node-pre-gyp@npm:^1.0.0": version: 1.0.9 resolution: "@mapbox/node-pre-gyp@npm:1.0.9" @@ -241,14 +235,14 @@ __metadata: languageName: node linkType: hard -"@sapphire/async-queue@npm:^1.3.1, @sapphire/async-queue@npm:^1.3.2": +"@sapphire/async-queue@npm:^1.3.2": version: 1.3.2 resolution: "@sapphire/async-queue@npm:1.3.2" checksum: 348f35a278bff68cb6d5e2c2219b03ce66243162522003bb14426e5fdad251300bea8ef3883043eb034c181dddd52296a519e9f377075a5b31074807fe163e76 languageName: node linkType: hard -"@sapphire/shapeshift@npm:^3.1.0, @sapphire/shapeshift@npm:^3.5.1": +"@sapphire/shapeshift@npm:^3.5.1": version: 3.5.1 resolution: "@sapphire/shapeshift@npm:3.5.1" dependencies: @@ -288,7 +282,7 @@ __metadata: languageName: node linkType: hard -"@sentry/integrations@npm:^7.5.1": +"@sentry/integrations@npm:^7.9.0": version: 7.9.0 resolution: "@sentry/integrations@npm:7.9.0" dependencies: @@ -300,7 +294,7 @@ __metadata: languageName: node linkType: hard -"@sentry/node@npm:^7.5.1": +"@sentry/node@npm:^7.9.0": version: 7.9.0 resolution: "@sentry/node@npm:7.9.0" dependencies: @@ -316,7 +310,7 @@ __metadata: languageName: node linkType: hard -"@sentry/tracing@npm:^7.5.1": +"@sentry/tracing@npm:^7.9.0": version: 7.9.0 resolution: "@sentry/tracing@npm:7.9.0" dependencies: @@ -328,7 +322,7 @@ __metadata: languageName: node linkType: hard -"@sentry/types@npm:7.9.0, @sentry/types@npm:^7.5.1": +"@sentry/types@npm:7.9.0, @sentry/types@npm:^7.9.0": version: 7.9.0 resolution: "@sentry/types@npm:7.9.0" checksum: 5f56d27454cab0344554bd85e9db8c34827dffa61145150664dc1ff478aaf599bffceb3a6bb20f592f0d8080b1f26b7af03c306a09c6463b8de4bdfdd10eecba @@ -345,10 +339,10 @@ __metadata: languageName: node linkType: hard -"@sindresorhus/is@npm:^4.6.0": - version: 4.6.0 - resolution: "@sindresorhus/is@npm:4.6.0" - checksum: 83839f13da2c29d55c97abc3bc2c55b250d33a0447554997a85c539e058e57b8da092da396e252b11ec24a0279a0bed1f537fa26302209327060643e327f81d2 +"@sindresorhus/is@npm:^0.14.0": + version: 0.14.0 + resolution: "@sindresorhus/is@npm:0.14.0" + checksum: 971e0441dd44ba3909b467219a5e242da0fc584048db5324cfb8048148fa8dcc9d44d71e3948972c4f6121d24e5da402ef191420d1266a95f713bb6d6e59c98a languageName: node linkType: hard @@ -359,6 +353,15 @@ __metadata: languageName: node linkType: hard +"@szmarczak/http-timer@npm:^1.1.2": + version: 1.1.2 + resolution: "@szmarczak/http-timer@npm:1.1.2" + dependencies: + defer-to-connect: ^1.0.1 + checksum: 4d9158061c5f397c57b4988cde33a163244e4f02df16364f103971957a32886beb104d6180902cbe8b38cb940e234d9f98a4e486200deca621923f62f50a06fe + languageName: node + linkType: hard + "@szmarczak/http-timer@npm:^5.0.1": version: 5.0.1 resolution: "@szmarczak/http-timer@npm:5.0.1" @@ -516,7 +519,7 @@ __metadata: languageName: node linkType: hard -"@types/keyv@npm:*": +"@types/keyv@npm:*, @types/keyv@npm:^3.1.1": version: 3.1.4 resolution: "@types/keyv@npm:3.1.4" dependencies: @@ -553,13 +556,20 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:^18.0.3": +"@types/node@npm:*, @types/node@npm:^18.6.4": version: 18.6.4 resolution: "@types/node@npm:18.6.4" checksum: fc453dd2b541f5812ba1a8f957f577727cf2d8aee886f1d5c03eb153b2b3373d2e0953c5bd2b7a5b184073bc317f54ec91f1ec4830a58eda4a833e90654021de languageName: node linkType: hard +"@types/node@npm:^16.11.26": + version: 16.11.45 + resolution: "@types/node@npm:16.11.45" + checksum: 57d61c951024f66d796e71e4a972faef266007398cd4e93a195822fea2d5deb41d0615f394a99ece89772b145ff057321d138c7e3442455dc7d785ff67cebde3 + languageName: node + linkType: hard + "@types/numeral@npm:^2.0.2": version: 2.0.2 resolution: "@types/numeral@npm:2.0.2" @@ -578,7 +588,7 @@ __metadata: languageName: node linkType: hard -"@types/prettier@npm:^2.6.3": +"@types/prettier@npm:^2.7.0": version: 2.7.0 resolution: "@types/prettier@npm:2.7.0" checksum: bf5d0c7c1270909b39399539ac106d20ddaa85fe92eb1d59922dc99159604b4f8d5e41b0045fb29c8011585cf5bca2350b7441ef3d9816c08bd0e10ebd4b31d4 @@ -635,7 +645,7 @@ __metadata: languageName: node linkType: hard -"@types/validator@npm:^13.7.1, @types/validator@npm:^13.7.4": +"@types/validator@npm:^13.7.1, @types/validator@npm:^13.7.5": version: 13.7.5 resolution: "@types/validator@npm:13.7.5" checksum: cc143351a23aef713b5d6b6794314b6b8b8332511cf44070c3358559b43267217b01c85eab0965c6104ffea362124a949187f348c67ff94ab0ee9966af6d3728 @@ -651,7 +661,16 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.30.5": +"@types/yauzl@npm:^2.9.1": + version: 2.10.0 + resolution: "@types/yauzl@npm:2.10.0" + dependencies: + "@types/node": "*" + checksum: 55d27ae5d346ea260e40121675c24e112ef0247649073848e5d4e03182713ae4ec8142b98f61a1c6cbe7d3b72fa99bbadb65d8b01873e5e605cdc30f1ff70ef2 + languageName: node + linkType: hard + +"@typescript-eslint/eslint-plugin@npm:^5.32.0": version: 5.32.0 resolution: "@typescript-eslint/eslint-plugin@npm:5.32.0" dependencies: @@ -685,7 +704,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.30.5": +"@typescript-eslint/parser@npm:^5.32.0": version: 5.32.0 resolution: "@typescript-eslint/parser@npm:5.32.0" dependencies: @@ -989,6 +1008,13 @@ __metadata: languageName: node linkType: hard +"boolean@npm:^3.0.1": + version: 3.2.0 + resolution: "boolean@npm:3.2.0" + checksum: fb29535b8bf710ef45279677a86d14f5185d604557204abd2ca5fa3fb2a5c80e04d695c8dbf13ab269991977a79bb6c04b048220a6b2a3849853faa94f4a7d77 + languageName: node + linkType: hard + "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -1076,59 +1102,61 @@ __metadata: version: 0.0.0-use.local resolution: "bush-bot@workspace:." dependencies: - "@discordjs/builders": ^0.15.0 - "@discordjs/rest": ^0.5.0 + "@discordjs/builders": ^1.1.0 + "@discordjs/rest": ^1.0.1 + "@ironm00n/nbt-ts": ^1.4.0 "@notenoughupdates/discord.js-minesweeper": ^1.0.10 "@notenoughupdates/events-intercept": ^3.0.1 "@notenoughupdates/humanize-duration": ^4.0.1 "@notenoughupdates/simplify-number": ^1.0.1 "@notenoughupdates/wolfram-alpha-api": ^1.0.2 "@sapphire/snowflake": ^3.2.2 - "@sentry/integrations": ^7.5.1 - "@sentry/node": ^7.5.1 - "@sentry/tracing": ^7.5.1 - "@sentry/types": ^7.5.1 + "@sentry/integrations": ^7.9.0 + "@sentry/node": ^7.9.0 + "@sentry/tracing": ^7.9.0 + "@sentry/types": ^7.9.0 "@types/eslint": ^8.4.5 "@types/express": ^4.17.13 "@types/lodash": ^4.14.182 - "@types/node": ^18.0.3 + "@types/node": ^18.6.4 "@types/numeral": ^2.0.2 "@types/pg": ^8.6.5 - "@types/prettier": ^2.6.3 + "@types/prettier": ^2.7.0 "@types/rimraf": ^3.0.2 "@types/tinycolor2": ^1.4.3 - "@types/validator": ^13.7.4 - "@typescript-eslint/eslint-plugin": ^5.30.5 - "@typescript-eslint/parser": ^5.30.5 + "@types/validator": ^13.7.5 + "@typescript-eslint/eslint-plugin": ^5.32.0 + "@typescript-eslint/parser": ^5.32.0 canvas: ^2.9.3 chalk: ^5.0.1 deep-lock: ^1.0.0 discord-akairo: "npm:@notenoughupdates/discord-akairo@dev" - discord-api-types: 0.34.0 + discord-api-types: 0.37.1 discord.js: "npm:@notenoughupdates/discord.js@dev" - eslint: ^8.19.0 + electron: ^20.0.1 + eslint: ^8.21.0 eslint-config-prettier: ^8.5.0 eslint-plugin-deprecation: ^1.3.2 eslint-plugin-import: ^2.26.0 fuse.js: ^6.6.2 gif-to-apng: ^0.1.2 googleapis: ^105.0.0 - got: ^12.1.0 + got: ^12.3.0 lodash: ^4.17.21 - mathjs: ^10.6.4 + mathjs: ^11.0.1 nanoid: ^4.0.0 - node-fetch: ^3.2.6 + node-fetch: ^3.2.10 numeral: ^2.0.6 pg: ^8.7.3 pg-hstore: ^2.3.4 prettier: ^2.7.1 pretty-bytes: ^6.0.0 rimraf: ^3.0.2 - sequelize: 6.21.2 + sequelize: 6.21.3 tinycolor2: ^1.4.2 ts-essentials: ^9.2.0 typescript: ^4.7.4 - vitest: ^0.17.1 + vitest: ^0.21.0 vm2: ^3.9.10 languageName: unknown linkType: soft @@ -1166,6 +1194,21 @@ __metadata: languageName: node linkType: hard +"cacheable-request@npm:^6.0.0": + version: 6.1.0 + resolution: "cacheable-request@npm:6.1.0" + dependencies: + clone-response: ^1.0.2 + get-stream: ^5.1.0 + http-cache-semantics: ^4.0.0 + keyv: ^3.0.0 + lowercase-keys: ^2.0.0 + normalize-url: ^4.1.0 + responselike: ^1.0.2 + checksum: b510b237b18d17e89942e9ee2d2a077cb38db03f12167fd100932dfa8fc963424bfae0bfa1598df4ae16c944a5484e43e03df8f32105b04395ee9495e9e4e9f1 + languageName: node + linkType: hard + "cacheable-request@npm:^7.0.2": version: 7.0.2 resolution: "cacheable-request@npm:7.0.2" @@ -1328,6 +1371,16 @@ __metadata: languageName: node linkType: hard +"config-chain@npm:^1.1.11": + version: 1.1.13 + resolution: "config-chain@npm:1.1.13" + dependencies: + ini: ^1.3.4 + proto-list: ~1.2.1 + checksum: 828137a28e7c2fc4b7fb229bd0cd6c1397bcf83434de54347e608154008f411749041ee392cbe42fab6307e02de4c12480260bf769b7d44b778fdea3839eafab + languageName: node + linkType: hard + "console-control-strings@npm:^1.0.0, console-control-strings@npm:^1.1.0": version: 1.1.0 resolution: "console-control-strings@npm:1.1.0" @@ -1415,6 +1468,15 @@ __metadata: languageName: node linkType: hard +"decompress-response@npm:^3.3.0": + version: 3.3.0 + resolution: "decompress-response@npm:3.3.0" + dependencies: + mimic-response: ^1.0.0 + checksum: 952552ac3bd7de2fc18015086b09468645c9638d98a551305e485230ada278c039c91116e946d07894b39ee53c0f0d5b6473f25a224029344354513b412d7380 + languageName: node + linkType: hard + "decompress-response@npm:^4.2.0": version: 4.2.1 resolution: "decompress-response@npm:4.2.1" @@ -1519,6 +1581,13 @@ __metadata: languageName: node linkType: hard +"defer-to-connect@npm:^1.0.1": + version: 1.1.3 + resolution: "defer-to-connect@npm:1.1.3" + checksum: 9491b301dcfa04956f989481ba7a43c2231044206269eb4ab64a52d6639ee15b1252262a789eb4239fb46ab63e44d4e408641bae8e0793d640aee55398cb3930 + languageName: node + linkType: hard + "defer-to-connect@npm:^2.0.1": version: 2.0.1 resolution: "defer-to-connect@npm:2.0.1" @@ -1557,6 +1626,13 @@ __metadata: languageName: node linkType: hard +"detect-node@npm:^2.0.4": + version: 2.1.0 + resolution: "detect-node@npm:2.1.0" + checksum: 832184ec458353e41533ac9c622f16c19f7c02d8b10c303dfd3a756f56be93e903616c0bb2d4226183c9351c15fc0b3dba41a17a2308262afabcfa3776e6ae6e + languageName: node + linkType: hard + "dir-glob@npm:^3.0.1": version: 3.0.1 resolution: "dir-glob@npm:3.0.1" @@ -1573,17 +1649,10 @@ __metadata: languageName: node linkType: hard -"discord-api-types@npm:0.34.0": - version: 0.34.0 - resolution: "discord-api-types@npm:0.34.0" - checksum: 16ef4a7e82c442808447d2062adb907c050f1c0b10b0dd7ffd459b5cbc2ae8e5ba46d17c645e401500a0263ee661c651d29ab5b41bd2af15a72281d03cba90dc - languageName: node - linkType: hard - -"discord-api-types@npm:^0.33.3": - version: 0.33.5 - resolution: "discord-api-types@npm:0.33.5" - checksum: 6dcaad640c5693a69c9a4f5e444e739dde11ba835164ae6fd3dd5a1ab7b4d7f96cd022ed653eeaff2c8051ead0d998a5d502a2915cfacdde596364b82d9e3b3f +"discord-api-types@npm:0.37.1": + version: 0.37.1 + resolution: "discord-api-types@npm:0.37.1" + checksum: 4adfd605dae426299b537105f657b4649535f446202051aaef0ccbbaf024175bdbe868487119480ff094c8e479c2e424ce393f2595b16e1840cc0f3a555e510f languageName: node linkType: hard @@ -1638,6 +1707,13 @@ __metadata: languageName: node linkType: hard +"duplexer3@npm:^0.1.4": + version: 0.1.5 + resolution: "duplexer3@npm:0.1.5" + checksum: e677cb4c48f031ca728601d6a20bf6aed4c629d69ef9643cb89c67583d673c4ec9317cc6427501f38bd8c368d3a18f173987cc02bd99d8cf8fe3d94259a22a20 + languageName: node + linkType: hard + "ecdsa-sig-formatter@npm:1.0.11, ecdsa-sig-formatter@npm:^1.0.11": version: 1.0.11 resolution: "ecdsa-sig-formatter@npm:1.0.11" @@ -1647,6 +1723,19 @@ __metadata: languageName: node linkType: hard +"electron@npm:^20.0.1": + version: 20.0.1 + resolution: "electron@npm:20.0.1" + dependencies: + "@electron/get": ^1.14.1 + "@types/node": ^16.11.26 + extract-zip: ^2.0.1 + bin: + electron: cli.js + checksum: 1ae66fdd7d9bb03bc8eaead814c429ccc20427cfc430ab70cd55c24e3f948c2aab7713de3478894ce15e5436bc4c5353b538062420b493f17bc62a626b836abe + languageName: node + linkType: hard + "emoji-regex@npm:^8.0.0": version: 8.0.0 resolution: "emoji-regex@npm:8.0.0" @@ -1654,6 +1743,13 @@ __metadata: languageName: node linkType: hard +"encodeurl@npm:^1.0.2": + version: 1.0.2 + resolution: "encodeurl@npm:1.0.2" + checksum: e50e3d508cdd9c4565ba72d2012e65038e5d71bdc9198cb125beb6237b5b1ade6c0d343998da9e170fb2eae52c1bed37d4d6d98a46ea423a0cddbed5ac3f780c + languageName: node + linkType: hard + "encoding@npm:^0.1.13": version: 0.1.13 resolution: "encoding@npm:0.1.13" @@ -1737,6 +1833,13 @@ __metadata: languageName: node linkType: hard +"es6-error@npm:^4.1.1": + version: 4.1.1 + resolution: "es6-error@npm:4.1.1" + checksum: ae41332a51ec1323da6bbc5d75b7803ccdeddfae17c41b6166ebbafc8e8beb7a7b80b884b7fab1cc80df485860ac3c59d78605e860bb4f8cd816b3d6ade0d010 + languageName: node + linkType: hard + "esbuild-android-64@npm:0.14.53": version: 0.14.53 resolution: "esbuild-android-64@npm:0.14.53" @@ -2078,7 +2181,7 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.19.0": +"eslint@npm:^8.21.0": version: 8.21.0 resolution: "eslint@npm:8.21.0" dependencies: @@ -2206,6 +2309,23 @@ __metadata: languageName: node linkType: hard +"extract-zip@npm:^2.0.1": + version: 2.0.1 + resolution: "extract-zip@npm:2.0.1" + dependencies: + "@types/yauzl": ^2.9.1 + debug: ^4.1.1 + get-stream: ^5.1.0 + yauzl: ^2.10.0 + dependenciesMeta: + "@types/yauzl": + optional: true + bin: + extract-zip: cli.js + checksum: 8cbda9debdd6d6980819cc69734d874ddd71051c9fe5bde1ef307ebcedfe949ba57b004894b585f758b7c9eeeea0e3d87f2dda89b7d25320459c2c9643ebb635 + languageName: node + linkType: hard + "fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": version: 3.1.3 resolution: "fast-deep-equal@npm:3.1.3" @@ -2391,6 +2511,17 @@ __metadata: languageName: node linkType: hard +"fs-extra@npm:^8.1.0": + version: 8.1.0 + resolution: "fs-extra@npm:8.1.0" + dependencies: + graceful-fs: ^4.2.0 + jsonfile: ^4.0.0 + universalify: ^0.1.0 + checksum: bf44f0e6cea59d5ce071bba4c43ca76d216f89e402dc6285c128abc0902e9b8525135aa808adad72c9d5d218e9f4bcc63962815529ff2f684ad532172a284880 + languageName: node + linkType: hard + "fs-minipass@npm:^2.0.0, fs-minipass@npm:^2.1.0": version: 2.1.0 resolution: "fs-minipass@npm:2.1.0" @@ -2569,6 +2700,15 @@ __metadata: languageName: node linkType: hard +"get-stream@npm:^4.1.0": + version: 4.1.0 + resolution: "get-stream@npm:4.1.0" + dependencies: + pump: ^3.0.0 + checksum: 443e1914170c15bd52ff8ea6eff6dfc6d712b031303e36302d2778e3de2506af9ee964d6124010f7818736dcfde05c04ba7ca6cc26883106e084357a17ae7d73 + languageName: node + linkType: hard + "get-stream@npm:^5.1.0": version: 5.2.0 resolution: "get-stream@npm:5.2.0" @@ -2650,6 +2790,32 @@ __metadata: languageName: node linkType: hard +"global-agent@npm:^3.0.0": + version: 3.0.0 + resolution: "global-agent@npm:3.0.0" + dependencies: + boolean: ^3.0.1 + es6-error: ^4.1.1 + matcher: ^3.0.0 + roarr: ^2.15.3 + semver: ^7.3.2 + serialize-error: ^7.0.1 + checksum: 75074d80733b4bd5386c47f5df028e798018025beac0ab310e9908c72bf5639e408203e7bca0130d5ee01b5f4abc6d34385d96a9f950ea5fe1979bb431c808f7 + languageName: node + linkType: hard + +"global-tunnel-ng@npm:^2.7.1": + version: 2.7.1 + resolution: "global-tunnel-ng@npm:2.7.1" + dependencies: + encodeurl: ^1.0.2 + lodash: ^4.17.10 + npm-conf: ^1.1.3 + tunnel: ^0.0.6 + checksum: b7e016093eab6058b5fdd8caea31c22dc1a607f0f0b41c001ade5e0227c5d74efe9ce9bae56316d794bc1cedd461a187b8b7e8f0a3eb4d194972cdfb9d860af2 + languageName: node + linkType: hard + "globals@npm:^13.15.0": version: 13.17.0 resolution: "globals@npm:13.17.0" @@ -2659,6 +2825,15 @@ __metadata: languageName: node linkType: hard +"globalthis@npm:^1.0.1": + version: 1.0.3 + resolution: "globalthis@npm:1.0.3" + dependencies: + define-properties: ^1.1.3 + checksum: fbd7d760dc464c886d0196166d92e5ffb4c84d0730846d6621a39fbbc068aeeb9c8d1421ad330e94b7bca4bb4ea092f5f21f3d36077812af5d098b4dc006c998 + languageName: node + linkType: hard + "globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" @@ -2725,7 +2900,7 @@ __metadata: languageName: node linkType: hard -"got@npm:^12.1.0": +"got@npm:^12.3.0": version: 12.3.0 resolution: "got@npm:12.3.0" dependencies: @@ -2746,7 +2921,26 @@ __metadata: languageName: node linkType: hard -"graceful-fs@npm:^4.1.10, graceful-fs@npm:^4.2.6": +"got@npm:^9.6.0": + version: 9.6.0 + resolution: "got@npm:9.6.0" + dependencies: + "@sindresorhus/is": ^0.14.0 + "@szmarczak/http-timer": ^1.1.2 + cacheable-request: ^6.0.0 + decompress-response: ^3.3.0 + duplexer3: ^0.1.4 + get-stream: ^4.1.0 + lowercase-keys: ^1.0.1 + mimic-response: ^1.0.1 + p-cancelable: ^1.0.0 + to-readable-stream: ^1.0.0 + url-parse-lax: ^3.0.0 + checksum: 941807bd9704bacf5eb401f0cc1212ffa1f67c6642f2d028fd75900471c221b1da2b8527f4553d2558f3faeda62ea1cf31665f8b002c6137f5de8732f07370b0 + languageName: node + linkType: hard + +"graceful-fs@npm:^4.1.10, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.6": version: 4.2.10 resolution: "graceful-fs@npm:4.2.10" checksum: 3f109d70ae123951905d85032ebeae3c2a5a7a997430df00ea30df0e3a6c60cf6689b109654d6fdacd28810a053348c4d14642da1d075049e6be1ba5216218da @@ -2958,6 +3152,13 @@ __metadata: languageName: node linkType: hard +"ini@npm:^1.3.4": + version: 1.3.8 + resolution: "ini@npm:1.3.8" + checksum: dfd98b0ca3a4fc1e323e38a6c8eb8936e31a97a918d3b377649ea15bdb15d481207a0dda1021efbd86b464cae29a0d33c1d7dcaf6c5672bee17fa849bc50a1b3 + languageName: node + linkType: hard + "internal-slot@npm:^1.0.3": version: 1.0.3 resolution: "internal-slot@npm:1.0.3" @@ -3181,6 +3382,13 @@ __metadata: languageName: node linkType: hard +"json-buffer@npm:3.0.0": + version: 3.0.0 + resolution: "json-buffer@npm:3.0.0" + checksum: 0cecacb8025370686a916069a2ff81f7d55167421b6aa7270ee74e244012650dd6bce22b0852202ea7ff8624fce50ff0ec1bdf95914ccb4553426e290d5a63fa + languageName: node + linkType: hard + "json-buffer@npm:3.0.1, json-buffer@npm:~3.0.1": version: 3.0.1 resolution: "json-buffer@npm:3.0.1" @@ -3202,6 +3410,13 @@ __metadata: languageName: node linkType: hard +"json-stringify-safe@npm:^5.0.1": + version: 5.0.1 + resolution: "json-stringify-safe@npm:5.0.1" + checksum: 48ec0adad5280b8a96bb93f4563aa1667fd7a36334f79149abd42446d0989f2ddc58274b479f4819f1f00617957e6344c886c55d05a4e15ebb4ab931e4a6a8ee + languageName: node + linkType: hard + "json5@npm:^1.0.1": version: 1.0.1 resolution: "json5@npm:1.0.1" @@ -3213,6 +3428,18 @@ __metadata: languageName: node linkType: hard +"jsonfile@npm:^4.0.0": + version: 4.0.0 + resolution: "jsonfile@npm:4.0.0" + dependencies: + graceful-fs: ^4.1.6 + dependenciesMeta: + graceful-fs: + optional: true + checksum: 6447d6224f0d31623eef9b51185af03ac328a7553efcee30fa423d98a9e276ca08db87d71e17f2310b0263fd3ffa6c2a90a6308367f661dc21580f9469897c9e + languageName: node + linkType: hard + "jwa@npm:^2.0.0": version: 2.0.0 resolution: "jwa@npm:2.0.0" @@ -3234,6 +3461,15 @@ __metadata: languageName: node linkType: hard +"keyv@npm:^3.0.0": + version: 3.1.0 + resolution: "keyv@npm:3.1.0" + dependencies: + json-buffer: 3.0.0 + checksum: bb7e8f3acffdbafbc2dd5b63f377fe6ec4c0e2c44fc82720449ef8ab54f4a7ce3802671ed94c0f475ae0a8549703353a2124561fcf3317010c141b32ca1ce903 + languageName: node + linkType: hard + "keyv@npm:^4.0.0": version: 4.3.3 resolution: "keyv@npm:4.3.3" @@ -3263,7 +3499,7 @@ __metadata: languageName: node linkType: hard -"local-pkg@npm:^0.4.1": +"local-pkg@npm:^0.4.2": version: 0.4.2 resolution: "local-pkg@npm:0.4.2" checksum: 22be451353c25c4411b552bf01880ebc9e995b93574b2facc7757968d888356df59199cacada14162ab53bbc9da055bb692c907b4171f008dbce45a2afc777c1 @@ -3319,7 +3555,7 @@ __metadata: languageName: node linkType: hard -"lodash@npm:^4.17.21": +"lodash@npm:^4.17.10, lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 @@ -3335,6 +3571,13 @@ __metadata: languageName: node linkType: hard +"lowercase-keys@npm:^1.0.0, lowercase-keys@npm:^1.0.1": + version: 1.0.1 + resolution: "lowercase-keys@npm:1.0.1" + checksum: 4d045026595936e09953e3867722e309415ff2c80d7701d067546d75ef698dac218a4f53c6d1d0e7368b47e45fd7529df47e6cb56fbb90523ba599f898b3d147 + languageName: node + linkType: hard + "lowercase-keys@npm:^2.0.0": version: 2.0.0 resolution: "lowercase-keys@npm:2.0.0" @@ -3424,11 +3667,20 @@ __metadata: languageName: node linkType: hard -"mathjs@npm:^10.6.4": - version: 10.6.4 - resolution: "mathjs@npm:10.6.4" +"matcher@npm:^3.0.0": + version: 3.0.0 + resolution: "matcher@npm:3.0.0" + dependencies: + escape-string-regexp: ^4.0.0 + checksum: 8bee1a7ab7609c2c21d9c9254b6785fa708eadf289032b556d57a34e98fcd4c537659a004dafee6ce80ab157099e645c199dc52678dff1e7fb0a6684e0da4dbe + languageName: node + linkType: hard + +"mathjs@npm:^11.0.1": + version: 11.0.1 + resolution: "mathjs@npm:11.0.1" dependencies: - "@babel/runtime": ^7.18.6 + "@babel/runtime": ^7.18.9 complex.js: ^2.1.1 decimal.js: ^10.3.1 escape-latex: ^1.2.0 @@ -3436,10 +3688,10 @@ __metadata: javascript-natural-sort: ^0.7.1 seedrandom: ^3.0.5 tiny-emitter: ^2.1.0 - typed-function: ^2.1.0 + typed-function: ^3.0.0 bin: mathjs: bin/cli.js - checksum: 64c785d6f3cd0500888be31793d677d50f7da51b04fe009ba2d5be5f29948b3ef70fd26f8fa80064f4c18716a9ab59dd600236ffcca7e9ea6265a91c5b1540a9 + checksum: 2feb1c9c16ff7a8375ec678bfc9e114007739cfb4fff7409042779f3f9496107974a4bb49a01e9e7358222f30d5b32fb763b41bf9b2a08ab84376af397825af1 languageName: node linkType: hard @@ -3460,7 +3712,7 @@ __metadata: languageName: node linkType: hard -"mimic-response@npm:^1.0.0": +"mimic-response@npm:^1.0.0, mimic-response@npm:^1.0.1": version: 1.0.1 resolution: "mimic-response@npm:1.0.1" checksum: 034c78753b0e622bc03c983663b1cdf66d03861050e0c8606563d149bc2b02d63f62ce4d32be4ab50d0553ae0ffe647fc34d1f5281184c6e1e8cf4d85e8d9823 @@ -3684,7 +3936,7 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:^3.2.6": +"node-fetch@npm:^3.2.10": version: 3.2.10 resolution: "node-fetch@npm:3.2.10" dependencies: @@ -3733,6 +3985,13 @@ __metadata: languageName: node linkType: hard +"normalize-url@npm:^4.1.0": + version: 4.5.1 + resolution: "normalize-url@npm:4.5.1" + checksum: 9a9dee01df02ad23e171171893e56e22d752f7cff86fb96aafeae074819b572ea655b60f8302e2d85dbb834dc885c972cc1c573892fea24df46b2765065dd05a + languageName: node + linkType: hard + "normalize-url@npm:^6.0.1": version: 6.1.0 resolution: "normalize-url@npm:6.1.0" @@ -3740,6 +3999,16 @@ __metadata: languageName: node linkType: hard +"npm-conf@npm:^1.1.3": + version: 1.1.3 + resolution: "npm-conf@npm:1.1.3" + dependencies: + config-chain: ^1.1.11 + pify: ^3.0.0 + checksum: 2d4e933b657623d98183ec408d17318547296b1cd17c4d3587e2920c554675f24f829d8f5f7f84db3a020516678fdcd01952ebaaf0e7fa8a17f6c39be4154bef + languageName: node + linkType: hard + "npm-run-path@npm:^2.0.0": version: 2.0.2 resolution: "npm-run-path@npm:2.0.2" @@ -3847,6 +4116,13 @@ __metadata: languageName: node linkType: hard +"p-cancelable@npm:^1.0.0": + version: 1.1.0 + resolution: "p-cancelable@npm:1.1.0" + checksum: 2db3814fef6d9025787f30afaee4496a8857a28be3c5706432cbad76c688a6db1874308f48e364a42f5317f5e41e8e7b4f2ff5c8ff2256dbb6264bc361704ece + languageName: node + linkType: hard + "p-cancelable@npm:^3.0.0": version: 3.0.0 resolution: "p-cancelable@npm:3.0.0" @@ -4172,6 +4448,13 @@ __metadata: languageName: node linkType: hard +"prepend-http@npm:^2.0.0": + version: 2.0.0 + resolution: "prepend-http@npm:2.0.0" + checksum: 7694a9525405447662c1ffd352fcb41b6410c705b739b6f4e3a3e21cf5fdede8377890088e8934436b8b17ba55365a615f153960f30877bf0d0392f9e93503ea + languageName: node + linkType: hard + "prettier@npm:^2.7.1": version: 2.7.1 resolution: "prettier@npm:2.7.1" @@ -4195,6 +4478,13 @@ __metadata: languageName: node linkType: hard +"progress@npm:^2.0.3": + version: 2.0.3 + resolution: "progress@npm:2.0.3" + checksum: f67403fe7b34912148d9252cb7481266a354bd99ce82c835f79070643bb3c6583d10dbcfda4d41e04bbc1d8437e9af0fb1e1f2135727878f5308682a579429b7 + languageName: node + linkType: hard + "promise-inflight@npm:^1.0.1": version: 1.0.1 resolution: "promise-inflight@npm:1.0.1" @@ -4212,6 +4502,13 @@ __metadata: languageName: node linkType: hard +"proto-list@npm:~1.2.1": + version: 1.2.4 + resolution: "proto-list@npm:1.2.4" + checksum: 4d4826e1713cbfa0f15124ab0ae494c91b597a3c458670c9714c36e8baddf5a6aad22842776f2f5b137f259c8533e741771445eb8df82e861eea37a6eaba03f7 + languageName: node + linkType: hard + "pseudomap@npm:^1.0.2": version: 1.0.2 resolution: "pseudomap@npm:1.0.2" @@ -4359,6 +4656,15 @@ __metadata: languageName: node linkType: hard +"responselike@npm:^1.0.2": + version: 1.0.2 + resolution: "responselike@npm:1.0.2" + dependencies: + lowercase-keys: ^1.0.0 + checksum: 2e9e70f1dcca3da621a80ce71f2f9a9cad12c047145c6ece20df22f0743f051cf7c73505e109814915f23f9e34fb0d358e22827723ee3d56b623533cab8eafcd + languageName: node + linkType: hard + "responselike@npm:^2.0.0": version: 2.0.1 resolution: "responselike@npm:2.0.1" @@ -4400,6 +4706,20 @@ __metadata: languageName: node linkType: hard +"roarr@npm:^2.15.3": + version: 2.15.4 + resolution: "roarr@npm:2.15.4" + dependencies: + boolean: ^3.0.1 + detect-node: ^2.0.4 + globalthis: ^1.0.1 + json-stringify-safe: ^5.0.1 + semver-compare: ^1.0.0 + sprintf-js: ^1.1.2 + checksum: 682e28d5491e3ae99728a35ba188f4f0ccb6347dbd492f95dc9f4bfdfe8ee63d8203ad234766ee2db88c8d7a300714304976eb095ce5c9366fe586c03a21586c + languageName: node + linkType: hard + "rollup@npm:^2.75.6": version: 2.77.2 resolution: "rollup@npm:2.77.2" @@ -4463,7 +4783,14 @@ __metadata: languageName: node linkType: hard -"semver@npm:^6.0.0": +"semver-compare@npm:^1.0.0": + version: 1.0.0 + resolution: "semver-compare@npm:1.0.0" + checksum: dd1d7e2909744cf2cf71864ac718efc990297f9de2913b68e41a214319e70174b1d1793ac16e31183b128c2b9812541300cb324db8168e6cf6b570703b171c68 + languageName: node + linkType: hard + +"semver@npm:^6.0.0, semver@npm:^6.2.0": version: 6.3.0 resolution: "semver@npm:6.3.0" bin: @@ -4472,7 +4799,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.3.5, semver@npm:^7.3.7": +"semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7": version: 7.3.7 resolution: "semver@npm:7.3.7" dependencies: @@ -4490,9 +4817,9 @@ __metadata: languageName: node linkType: hard -"sequelize@npm:6.21.2": - version: 6.21.2 - resolution: "sequelize@npm:6.21.2" +"sequelize@npm:6.21.3": + version: 6.21.3 + resolution: "sequelize@npm:6.21.3" dependencies: "@types/debug": ^4.1.7 "@types/validator": ^13.7.1 @@ -4527,7 +4854,16 @@ __metadata: optional: true tedious: optional: true - checksum: 5486ec15e80cf51e49d819c2495a05a17b5a0102866ca0af054dbc4a625d2dc6200e36189261e50234625fcf4da5cbc973eb9900591a5b9e9f63c67955196f56 + checksum: 85a57cdde00edc5e1634585aacda874eeab9cc0d6d296e5ae90be3d861cba682bacde427009600d331fec82396520621a16a27d1958c689dd197d9d88051cf7e + languageName: node + linkType: hard + +"serialize-error@npm:^7.0.1": + version: 7.0.1 + resolution: "serialize-error@npm:7.0.1" + dependencies: + type-fest: ^0.13.1 + checksum: e0aba4dca2fc9fe74ae1baf38dbd99190e1945445a241ba646290f2176cdb2032281a76443b02ccf0caf30da5657d510746506368889a593b9835a497fc0732e languageName: node linkType: hard @@ -4655,6 +4991,13 @@ __metadata: languageName: node linkType: hard +"sprintf-js@npm:^1.1.2": + version: 1.1.2 + resolution: "sprintf-js@npm:1.1.2" + checksum: d4bb46464632b335e5faed381bd331157e0af64915a98ede833452663bc672823db49d7531c32d58798e85236581fb7342fd0270531ffc8f914e186187bf1c90 + languageName: node + linkType: hard + "ssri@npm:^9.0.0": version: 9.0.1 resolution: "ssri@npm:9.0.1" @@ -4764,6 +5107,15 @@ __metadata: languageName: node linkType: hard +"sumchecker@npm:^3.0.1": + version: 3.0.1 + resolution: "sumchecker@npm:3.0.1" + dependencies: + debug: ^4.1.0 + checksum: 31ba7a62c889236b5b07f75b5c250d481158a1ca061b8f234fca0457bdbe48a20e5011c12c715343dc577e111463dc3d9e721b98015a445a2a88c35e0c9f0f91 + languageName: node + linkType: hard + "supports-color@npm:^7.1.0": version: 7.2.0 resolution: "supports-color@npm:7.2.0" @@ -4837,17 +5189,17 @@ __metadata: languageName: node linkType: hard -"tinypool@npm:^0.2.1": +"tinypool@npm:^0.2.4": version: 0.2.4 resolution: "tinypool@npm:0.2.4" checksum: f050bd36c89529a2a0d3f9c1fdbba3f317114e3ee6eb5d5ba72c51e887d45ef3ef8d8533fb2ca2eba7189d19d2231712b81b3a75e099248532f5563369929c33 languageName: node linkType: hard -"tinyspy@npm:^0.3.3": - version: 0.3.3 - resolution: "tinyspy@npm:0.3.3" - checksum: 1beb8f04c100d9ac769ff85266594f07d6f08f41cfb95c4bef9da3e59988b42e8d4e66c2ec455d3ecad80027347920e87d7a7098c5a2a28637f9fee25e11a8f1 +"tinyspy@npm:^1.0.0": + version: 1.0.0 + resolution: "tinyspy@npm:1.0.0" + checksum: f9a7cea406db9b0f99a4ef162eb0a45d88fc36facbc309702c8d568283baa363ab3c4138d8402fbfdef7a8d3157ff7cfae3e99ec6c75d8f684bd7b23485b5ec5 languageName: node linkType: hard @@ -4858,6 +5210,13 @@ __metadata: languageName: node linkType: hard +"to-readable-stream@npm:^1.0.0": + version: 1.0.0 + resolution: "to-readable-stream@npm:1.0.0" + checksum: 2bd7778490b6214a2c40276065dd88949f4cf7037ce3964c76838b8cb212893aeb9cceaaf4352a4c486e3336214c350270f3263e1ce7a0c38863a715a4d9aeb5 + languageName: node + linkType: hard + "to-regex-range@npm:^5.0.1": version: 5.0.1 resolution: "to-regex-range@npm:5.0.1" @@ -4868,12 +5227,12 @@ __metadata: linkType: hard "token-types@npm:^5.0.0-alpha.2": - version: 5.0.1 - resolution: "token-types@npm:5.0.1" + version: 5.0.0-alpha.2 + resolution: "token-types@npm:5.0.0-alpha.2" dependencies: "@tokenizer/token": ^0.3.0 ieee754: ^1.2.1 - checksum: 32780123bc6ce8b6a2231d860445c994a02a720abf38df5583ea957aa6626873cd1c4dd8af62314da4cf16ede00c379a765707a3b06f04b8808c38efdae1c785 + checksum: ee23eeed6f383b1072d99781d62fc7840f1296a96d47e636e36fca757debd7eb4274d31fcd2d56997606eede00b12b1e61a64610fe0ed7807d6b1c4dcf5ccc6b languageName: node linkType: hard @@ -4944,6 +5303,13 @@ __metadata: languageName: node linkType: hard +"tunnel@npm:^0.0.6": + version: 0.0.6 + resolution: "tunnel@npm:0.0.6" + checksum: c362948df9ad34b649b5585e54ce2838fa583aa3037091aaed66793c65b423a264e5229f0d7e9a95513a795ac2bd4cb72cda7e89a74313f182c1e9ae0b0994fa + languageName: node + linkType: hard + "type-check@npm:^0.4.0, type-check@npm:~0.4.0": version: 0.4.0 resolution: "type-check@npm:0.4.0" @@ -4960,6 +5326,13 @@ __metadata: languageName: node linkType: hard +"type-fest@npm:^0.13.1": + version: 0.13.1 + resolution: "type-fest@npm:0.13.1" + checksum: e6bf2e3c449f27d4ef5d56faf8b86feafbc3aec3025fc9a5fbe2db0a2587c44714521f9c30d8516a833c8c506d6263f5cc11267522b10c6ccdb6cc55b0a9d1c4 + languageName: node + linkType: hard + "type-fest@npm:^0.20.2": version: 0.20.2 resolution: "type-fest@npm:0.20.2" @@ -4967,10 +5340,10 @@ __metadata: languageName: node linkType: hard -"typed-function@npm:^2.1.0": - version: 2.1.0 - resolution: "typed-function@npm:2.1.0" - checksum: 168c2c8f765fbecc842521a5fb62a5800958f9fcb0ce78d69c38a5e96c81fe133f853256ec8ee245ee2fc42b4c9342b5ba754c732189550c64c12e758892dc43 +"typed-function@npm:^3.0.0": + version: 3.0.0 + resolution: "typed-function@npm:3.0.0" + checksum: f05afc8254dcb72815903c764fc3f8064a50ce1a0db9eb3a5134528209a852c8817682bdaf8ee9a73b316d4a4bbf92b6ae030934dd0983e7a2fd7fa487a71cec languageName: node linkType: hard @@ -5023,7 +5396,7 @@ __metadata: languageName: node linkType: hard -"undici@npm:^5.4.0, undici@npm:^5.8.0": +"undici@npm:^5.8.0": version: 5.8.1 resolution: "undici@npm:5.8.1" checksum: 0d5d8b9654f031a5490dcd89cd73db452ad51b06def08ce4ac07a1a46564cb6f039be4862bc013ec45b7ca465a468eb5c4caa761a26541958307f8d75878129a @@ -5048,6 +5421,13 @@ __metadata: languageName: node linkType: hard +"universalify@npm:^0.1.0": + version: 0.1.2 + resolution: "universalify@npm:0.1.2" + checksum: 40cdc60f6e61070fe658ca36016a8f4ec216b29bf04a55dce14e3710cc84c7448538ef4dad3728d0bfe29975ccd7bfb5f414c45e7b78883567fb31b246f02dff + languageName: node + linkType: hard + "uri-js@npm:^4.2.2": version: 4.4.1 resolution: "uri-js@npm:4.4.1" @@ -5057,6 +5437,15 @@ __metadata: languageName: node linkType: hard +"url-parse-lax@npm:^3.0.0": + version: 3.0.0 + resolution: "url-parse-lax@npm:3.0.0" + dependencies: + prepend-http: ^2.0.0 + checksum: 1040e357750451173132228036aff1fd04abbd43eac1fb3e4fca7495a078bcb8d33cb765fe71ad7e473d9c94d98fd67adca63bd2716c815a2da066198dd37217 + languageName: node + linkType: hard + "url-template@npm:^2.0.8": version: 2.0.8 resolution: "url-template@npm:2.0.8" @@ -5126,21 +5515,22 @@ __metadata: languageName: node linkType: hard -"vitest@npm:^0.17.1": - version: 0.17.1 - resolution: "vitest@npm:0.17.1" +"vitest@npm:^0.21.0": + version: 0.21.0 + resolution: "vitest@npm:0.21.0" dependencies: "@types/chai": ^4.3.1 "@types/chai-subset": ^1.3.3 "@types/node": "*" chai: ^4.3.6 debug: ^4.3.4 - local-pkg: ^0.4.1 - tinypool: ^0.2.1 - tinyspy: ^0.3.3 + local-pkg: ^0.4.2 + tinypool: ^0.2.4 + tinyspy: ^1.0.0 vite: ^2.9.12 || ^3.0.0-0 peerDependencies: "@edge-runtime/vm": "*" + "@vitest/browser": "*" "@vitest/ui": "*" c8: "*" happy-dom: "*" @@ -5148,6 +5538,8 @@ __metadata: peerDependenciesMeta: "@edge-runtime/vm": optional: true + "@vitest/browser": + optional: true "@vitest/ui": optional: true c8: @@ -5158,7 +5550,7 @@ __metadata: optional: true bin: vitest: vitest.mjs - checksum: eae2d024d97a46ba08f3cc7e0703a330c92dc0a6f4c7a9bc20ec8a5129bf787d8ebabd14bf31ae810897c1813e29178af59f63ec8b24b5944cfa62e225cd207c + checksum: c7aed226d7e67aa9409e7177c7dc6cacebc743212f22773b79d0d4795de83aff5c1c8559999b93c405afdef4f115cd527a84ecec4e2a25620be688ed3bd64695 languageName: node linkType: hard @@ -5301,7 +5693,7 @@ __metadata: languageName: node linkType: hard -"yauzl@npm:^2.4.2": +"yauzl@npm:^2.10.0, yauzl@npm:^2.4.2": version: 2.10.0 resolution: "yauzl@npm:2.10.0" dependencies: |