diff --git a/app.js b/app.js index 567ffde..eaae0cb 100644 --- a/app.js +++ b/app.js @@ -35,26 +35,14 @@ import { load } from "./utils/handler.js"; import { paths } from "./utils/collections.js"; // database stuff import database from "./utils/database.js"; -// lavalink stuff -import { reload, connect, connected } from "./utils/soundplayer.js"; + // events -import { endBroadcast, startBroadcast } from "./utils/misc.js"; import { parseThreshold } from "./utils/tempimages.js"; const { types } = JSON.parse(readFileSync(new URL("./config/commands.json", import.meta.url))); const esmBotVersion = JSON.parse(readFileSync(new URL("./package.json", import.meta.url))).version; process.env.ESMBOT_VER = esmBotVersion; -// const intents = [ -// "GUILD_VOICE_STATES", -// "DIRECT_MESSAGES", -// "GUILDS" -// ]; -// if (types.classic) { -// intents.push("GUILD_MESSAGES"); -// intents.push("MESSAGE_CONTENT"); -// } - async function* getFiles(dir) { const dirents = await promises.readdir(dir, { withFileTypes: true }); for (const dirent of dirents) { diff --git a/assets/images/jjosmap.png b/assets/images/jjosmap.png new file mode 100644 index 0000000..0c0392e Binary files /dev/null and b/assets/images/jjosmap.png differ diff --git a/commands/general/count.js b/commands/general/count.js index d95ec13..8205d4d 100644 --- a/commands/general/count.js +++ b/commands/general/count.js @@ -4,7 +4,6 @@ import * as collections from "../../utils/collections.js"; import { htmlescape } from "../../utils/misc.js"; class CountCommand extends Command { - static category = "general" async run() { const counts = await database.getCounts(); if (this.args.length !== 0) { @@ -26,7 +25,8 @@ class CountCommand extends Command { } return "You need to specify a command to see its usage amount!" } - + + static category = "general" static description = "Gets how many times a command was used"; static arguments = ["{mention/id}"]; static aliases = ["counts"]; diff --git a/commands/general/help.js b/commands/general/help.js index 9befa6c..d293341 100644 --- a/commands/general/help.js +++ b/commands/general/help.js @@ -18,22 +18,22 @@ class HelpCommand extends Command { return { html: html } } if (help.categories[this.args[0].toLowerCase()]) { - html = `

mrmBot Help - ${htmlescape(this.args[0])}

` + html = `

mrmBot Help - ${htmlescape(this.args[0])}

CommandDescription
\n` for (const [command] of collections.commands) { if (collections.info.get(command).category != this.args[0].toLowerCase()) continue; const description = collections.info.get(command).description; - html = html + `` + html = html + `\n` } - html = html + "
Command Description
${command}${description}
${command} ${description}
" + html = html + "
(mobile formatting will be fixed soon)" return { html: html } } } const prefix = htmlescape(process.env.PREFIX); - html = `

mrmBot Help - Categories

` + html = `

mrmBot Help - Categories

CategoryCommand
` for (const category of Object.keys(help.categories)) { - html = html + `` + html = html + `` } - html = html + "
Category Command
${category}${prefix}help ${category}
${category} ${prefix}help ${category}
" + html = html + "
(mobile formatting will be fixed soon)" return { html: html } // return { html: "

There are no mrmBot Docs Yet

In the meantime, please refer to https://esmbot.net/help.html" }; diff --git a/commands/image-editing/jjos.js b/commands/image-editing/jjos.js new file mode 100644 index 0000000..773932b --- /dev/null +++ b/commands/image-editing/jjos.js @@ -0,0 +1,20 @@ +import ImageCommand from "../../classes/imageCommand.js"; + +class ScottCommand extends ImageCommand { + static category = "image-editing" + static description = "JJoS an image"; + + params = { + assetPath: "assets/images/jjos.png", + distortPath: "assets/images/jjosmap.png", + compx: 261, + compy: 126 + }; + + static aliases = ["woz", "tv", "porn"]; + + static noImage = "You need to provide an image/GIF to JJoS!"; + static command = "scott"; +} + +export default ScottCommand; diff --git a/events/roommessage.js b/events/roommessage.js index 76b1387..f215fcb 100644 --- a/events/roommessage.js +++ b/events/roommessage.js @@ -3,7 +3,6 @@ import { log, error as _error, logger } from "../utils/logger.js"; import { prefixCache, aliases, disabledCache, disabledCmdCache, commands } from "../utils/collections.js"; import parseCommand from "../utils/parseCommand.js"; import { clean } from "../utils/misc.js"; -import sizeOf from "image-size"; // import { upload } from "../utils/tempimages.js"; let mentionRegex; diff --git a/natives/scott.cc b/natives/scott.cc index 500858d..ac708d9 100644 --- a/natives/scott.cc +++ b/natives/scott.cc @@ -8,6 +8,11 @@ using namespace vips; ArgumentMap Scott(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Arguments, size_t *DataSize) { string basePath = GetArgument(Arguments, "basePath"); + string assetPathIn = GetArgumentWithFallback(Arguments, "assetPath", "assets/images/scott.png"); + string distortPathIn = GetArgumentWithFallback(Arguments, "distortPath", "assets/images/scottmap.png"); + + int compx = GetArgumentWithFallback(Arguments, "compx", 127); + int compy = GetArgumentWithFallback(Arguments, "compy", 181); VOption *options = VImage::option()->set("access", "sequential"); @@ -21,10 +26,13 @@ ArgumentMap Scott(string type, string *outType, char *BufferData, size_t BufferL int pageHeight = vips_image_get_page_height(in.get_image()); int nPages = vips_image_get_n_pages(in.get_image()); - string assetPath = basePath + "assets/images/scott.png"; + string assetPath = basePath + assetPathIn; VImage bg = VImage::new_from_file(assetPath.c_str()); - string distortPath = basePath + "assets/images/scottmap.png"; + int bgwidth = bg.width(); + int bgpageHeight = vips_image_get_page_height(bg.get_image()); + + string distortPath = basePath + distortPathIn; VImage distort = VImage::new_from_file(distortPath.c_str()); VImage distortImage = @@ -40,7 +48,7 @@ ArgumentMap Scott(string type, string *outType, char *BufferData, size_t BufferL VImage mapped = resized.mapim(distortImage) .extract_band(0, VImage::option()->set("n", 3)) .bandjoin(distort[2]); - VImage offset = mapped.embed(127, 181, 864, 481); + VImage offset = mapped.embed(compx, compy, bgwidth, bgpageHeight); VImage composited = bg.composite2(offset, VIPS_BLEND_MODE_OVER); img.push_back(composited); } diff --git a/package.json b/package.json index e349fc2..9081f0c 100644 --- a/package.json +++ b/package.json @@ -31,12 +31,10 @@ "emoji-regex": "^10.2.1", "file-type": "^18.2.1", "format-duration": "^3.0.2", - "image-size": "^1.0.2", "jsqr": "^1.4.0", "matrix-js-sdk": "^23.4.0", "node-addon-api": "^5.1.0", "node-emoji": "^1.11.0", - "oceanic.js": "1.5.1", "qrcode": "^1.5.1", "sharp": "^0.31.3", "shoukaku": "^3.3.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 59f0c75..39a4f83 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,12 +15,10 @@ specifiers: eslint-plugin-unicorn: ^46.0.0 file-type: ^18.2.1 format-duration: ^3.0.2 - image-size: ^1.0.2 jsqr: ^1.4.0 matrix-js-sdk: ^23.4.0 node-addon-api: ^5.1.0 node-emoji: ^1.11.0 - oceanic.js: 1.5.1 pm2: ^5.2.2 postgres: ^3.3.4 qrcode: ^1.5.1 @@ -38,12 +36,10 @@ dependencies: emoji-regex: 10.2.1 file-type: 18.2.1 format-duration: 3.0.2 - image-size: 1.0.2 jsqr: 1.4.0 matrix-js-sdk: 23.4.0 node-addon-api: 5.1.0 node-emoji: 1.11.0 - oceanic.js: 1.5.1_bufferutil@4.0.7 qrcode: 1.5.1 sharp: 0.31.3 shoukaku: 3.3.1_bufferutil@4.0.7 @@ -400,26 +396,6 @@ packages: kuler: 2.0.0 dev: false - /@discordjs/voice/0.14.0_bufferutil@4.0.7: - resolution: {integrity: sha512-/LV8LSFuJ1c4OEW1ubPg3al2QNpUpwX8ZL+KL+LORmnUFVCtehSaEh+38uDfWg1O/TgiGI5vOLj4ZKql43drcw==} - engines: {node: '>=16.9.0'} - requiresBuild: true - dependencies: - '@types/ws': 8.5.4 - discord-api-types: 0.37.35 - prism-media: 1.3.5 - tslib: 2.5.0 - ws: 8.12.1_bufferutil@4.0.7 - transitivePeerDependencies: - - '@discordjs/opus' - - bufferutil - - ffmpeg-static - - node-opus - - opusscript - - utf-8-validate - dev: false - optional: true - /@eslint-community/eslint-utils/4.2.0_eslint@8.35.0: resolution: {integrity: sha512-gB8T4H4DEfX2IV9zGDJPOBgP1e/DbfCPDTtEqUMckpvzS1OYtva8JdFYBqMwYk7xAQ429WGF/UPqn8uQ//h2vQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -656,11 +632,6 @@ packages: resolution: {integrity: sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==} dev: false - /@types/node/18.14.6: - resolution: {integrity: sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==} - dev: false - optional: true - /@types/normalize-package-data/2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} dev: true @@ -673,13 +644,6 @@ packages: resolution: {integrity: sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==} dev: false - /@types/ws/8.5.4: - resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} - dependencies: - '@types/node': 18.14.6 - dev: false - optional: true - /acorn-jsx/5.3.2_acorn@8.8.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -1295,11 +1259,6 @@ packages: resolution: {integrity: sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==} dev: false - /discord-api-types/0.37.35: - resolution: {integrity: sha512-iyKZ/82k7FX3lcmHiAvvWu5TmyfVo78RtghBV/YsehK6CID83k5SI03DKKopBcln+TiEIYw5MGgq7SJXSpNzMg==} - dev: false - optional: true - /doctrine/3.0.0: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} @@ -1936,14 +1895,6 @@ packages: engines: {node: '>= 4'} dev: true - /image-size/1.0.2: - resolution: {integrity: sha512-xfOoWjceHntRb3qFCrh5ZFORYH8XCdYpASltMhZ/Q0KZiOwjdE/Yl2QCiWdwD+lygV5bMCvauzgu5PxBX/Yerg==} - engines: {node: '>=14.0.0'} - hasBin: true - dependencies: - queue: 6.0.2 - dev: false - /import-fresh/3.3.0: resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} engines: {node: '>=6'} @@ -2451,23 +2402,6 @@ packages: engines: {node: '>= 6'} dev: false - /oceanic.js/1.5.1_bufferutil@4.0.7: - resolution: {integrity: sha512-N4c25J8UCxYJ5BtqTc2EVmcRLyBO/ZGhMhwsIiodYBwBen9AX4ipqwAsAhoosOJi8+WrWiDzAI3mSJ4Lxt2Mww==} - engines: {node: '>=16.16.0'} - dependencies: - undici: 5.20.0 - ws: 8.12.1_bufferutil@4.0.7 - optionalDependencies: - '@discordjs/voice': 0.14.0_bufferutil@4.0.7 - transitivePeerDependencies: - - '@discordjs/opus' - - bufferutil - - ffmpeg-static - - node-opus - - opusscript - - utf-8-validate - dev: false - /once/1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: @@ -2782,25 +2716,6 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /prism-media/1.3.5: - resolution: {integrity: sha512-IQdl0Q01m4LrkN1EGIE9lphov5Hy7WWlH6ulf5QdGePLlPas9p2mhgddTEHrlaXYjjFToM1/rWuwF37VF4taaA==} - peerDependencies: - '@discordjs/opus': '>=0.8.0 <1.0.0' - ffmpeg-static: ^5.0.2 || ^4.2.7 || ^3.0.0 || ^2.4.0 - node-opus: ^0.3.3 - opusscript: ^0.0.8 - peerDependenciesMeta: - '@discordjs/opus': - optional: true - ffmpeg-static: - optional: true - node-opus: - optional: true - opusscript: - optional: true - dev: false - optional: true - /promptly/2.2.0: resolution: {integrity: sha512-aC9j+BZsRSSzEsXBNBwDnAxujdx19HycZoKgRgzWnS8eOHg1asuf9heuLprfbe739zY3IdUQx+Egv6Jn135WHA==} dependencies: @@ -2855,12 +2770,6 @@ packages: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true - /queue/6.0.2: - resolution: {integrity: sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==} - dependencies: - inherits: 2.0.4 - dev: false - /raw-body/2.5.2: resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} engines: {node: '>= 0.8'}