Compare commits

..

2 commits

Author SHA1 Message Date
murm
44f8f30ccc modified scott native to accept arbitrary values 2023-03-22 04:49:51 -04:00
murm
513efc4436 cleanup 2023-03-22 04:49:03 -04:00
9 changed files with 40 additions and 118 deletions

14
app.js
View file

@ -35,26 +35,14 @@ import { load } from "./utils/handler.js";
import { paths } from "./utils/collections.js"; import { paths } from "./utils/collections.js";
// database stuff // database stuff
import database from "./utils/database.js"; import database from "./utils/database.js";
// lavalink stuff
import { reload, connect, connected } from "./utils/soundplayer.js";
// events // events
import { endBroadcast, startBroadcast } from "./utils/misc.js";
import { parseThreshold } from "./utils/tempimages.js"; import { parseThreshold } from "./utils/tempimages.js";
const { types } = JSON.parse(readFileSync(new URL("./config/commands.json", import.meta.url))); 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; const esmBotVersion = JSON.parse(readFileSync(new URL("./package.json", import.meta.url))).version;
process.env.ESMBOT_VER = esmBotVersion; 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) { async function* getFiles(dir) {
const dirents = await promises.readdir(dir, { withFileTypes: true }); const dirents = await promises.readdir(dir, { withFileTypes: true });
for (const dirent of dirents) { for (const dirent of dirents) {

BIN
assets/images/jjosmap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -4,7 +4,6 @@ import * as collections from "../../utils/collections.js";
import { htmlescape } from "../../utils/misc.js"; import { htmlescape } from "../../utils/misc.js";
class CountCommand extends Command { class CountCommand extends Command {
static category = "general"
async run() { async run() {
const counts = await database.getCounts(); const counts = await database.getCounts();
if (this.args.length !== 0) { if (this.args.length !== 0) {
@ -27,6 +26,7 @@ class CountCommand extends Command {
return "You need to specify a command to see its usage amount!" 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 description = "Gets how many times a command was used";
static arguments = ["{mention/id}"]; static arguments = ["{mention/id}"];
static aliases = ["counts"]; static aliases = ["counts"];

View file

@ -18,22 +18,22 @@ class HelpCommand extends Command {
return { html: html } return { html: html }
} }
if (help.categories[this.args[0].toLowerCase()]) { if (help.categories[this.args[0].toLowerCase()]) {
html = `<h2>mrmBot Help - ${htmlescape(this.args[0])}</h2><table><tr><th>Command</th><th>Description</th></tr>` html = `<h2>mrmBot Help - ${htmlescape(this.args[0])}</h2><table><tr><th> Command </th><th> Description </th></tr>\n`
for (const [command] of collections.commands) { for (const [command] of collections.commands) {
if (collections.info.get(command).category != this.args[0].toLowerCase()) continue; if (collections.info.get(command).category != this.args[0].toLowerCase()) continue;
const description = collections.info.get(command).description; const description = collections.info.get(command).description;
html = html + `<tr><td>${command}</td><td>${description}</td></tr>` html = html + `<tr><td> ${command} </td><td> ${description} </td></tr>\n`
} }
html = html + "</table>" html = html + "</table><br><sub>(mobile formatting will be fixed soon)</sub>"
return { html: html } return { html: html }
} }
} }
const prefix = htmlescape(process.env.PREFIX); const prefix = htmlescape(process.env.PREFIX);
html = `<h2>mrmBot Help - Categories</h2><table><tr><th>Category</th><th>Command</th></tr>` html = `<h2>mrmBot Help - Categories</h2><table><tr><th> Category </th><th> Command </th></tr>`
for (const category of Object.keys(help.categories)) { for (const category of Object.keys(help.categories)) {
html = html + `<tr><td>${category}</td><td>${prefix}help ${category}</td></tr>` html = html + `<tr><td> ${category} </td><td> ${prefix}help ${category} </td></tr>`
} }
html = html + "</table>" html = html + "</table><br><sub>(mobile formatting will be fixed soon)</sub>"
return { html: html } return { html: html }
// return { html: "<h1>There are no mrmBot Docs Yet</h1>In the meantime, please refer to https://esmbot.net/help.html" }; // return { html: "<h1>There are no mrmBot Docs Yet</h1>In the meantime, please refer to https://esmbot.net/help.html" };

View file

@ -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;

View file

@ -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 { prefixCache, aliases, disabledCache, disabledCmdCache, commands } from "../utils/collections.js";
import parseCommand from "../utils/parseCommand.js"; import parseCommand from "../utils/parseCommand.js";
import { clean } from "../utils/misc.js"; import { clean } from "../utils/misc.js";
import sizeOf from "image-size";
// import { upload } from "../utils/tempimages.js"; // import { upload } from "../utils/tempimages.js";
let mentionRegex; let mentionRegex;

View file

@ -8,6 +8,11 @@ using namespace vips;
ArgumentMap Scott(string type, string *outType, char *BufferData, size_t BufferLength, ArgumentMap Scott(string type, string *outType, char *BufferData, size_t BufferLength,
ArgumentMap Arguments, size_t *DataSize) { ArgumentMap Arguments, size_t *DataSize) {
string basePath = GetArgument<string>(Arguments, "basePath"); string basePath = GetArgument<string>(Arguments, "basePath");
string assetPathIn = GetArgumentWithFallback<string>(Arguments, "assetPath", "assets/images/scott.png");
string distortPathIn = GetArgumentWithFallback<string>(Arguments, "distortPath", "assets/images/scottmap.png");
int compx = GetArgumentWithFallback<int>(Arguments, "compx", 127);
int compy = GetArgumentWithFallback<int>(Arguments, "compy", 181);
VOption *options = VImage::option()->set("access", "sequential"); 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 pageHeight = vips_image_get_page_height(in.get_image());
int nPages = vips_image_get_n_pages(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()); 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 distort = VImage::new_from_file(distortPath.c_str());
VImage distortImage = VImage distortImage =
@ -40,7 +48,7 @@ ArgumentMap Scott(string type, string *outType, char *BufferData, size_t BufferL
VImage mapped = resized.mapim(distortImage) VImage mapped = resized.mapim(distortImage)
.extract_band(0, VImage::option()->set("n", 3)) .extract_band(0, VImage::option()->set("n", 3))
.bandjoin(distort[2]); .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); VImage composited = bg.composite2(offset, VIPS_BLEND_MODE_OVER);
img.push_back(composited); img.push_back(composited);
} }

View file

@ -31,12 +31,10 @@
"emoji-regex": "^10.2.1", "emoji-regex": "^10.2.1",
"file-type": "^18.2.1", "file-type": "^18.2.1",
"format-duration": "^3.0.2", "format-duration": "^3.0.2",
"image-size": "^1.0.2",
"jsqr": "^1.4.0", "jsqr": "^1.4.0",
"matrix-js-sdk": "^23.4.0", "matrix-js-sdk": "^23.4.0",
"node-addon-api": "^5.1.0", "node-addon-api": "^5.1.0",
"node-emoji": "^1.11.0", "node-emoji": "^1.11.0",
"oceanic.js": "1.5.1",
"qrcode": "^1.5.1", "qrcode": "^1.5.1",
"sharp": "^0.31.3", "sharp": "^0.31.3",
"shoukaku": "^3.3.1", "shoukaku": "^3.3.1",

View file

@ -15,12 +15,10 @@ specifiers:
eslint-plugin-unicorn: ^46.0.0 eslint-plugin-unicorn: ^46.0.0
file-type: ^18.2.1 file-type: ^18.2.1
format-duration: ^3.0.2 format-duration: ^3.0.2
image-size: ^1.0.2
jsqr: ^1.4.0 jsqr: ^1.4.0
matrix-js-sdk: ^23.4.0 matrix-js-sdk: ^23.4.0
node-addon-api: ^5.1.0 node-addon-api: ^5.1.0
node-emoji: ^1.11.0 node-emoji: ^1.11.0
oceanic.js: 1.5.1
pm2: ^5.2.2 pm2: ^5.2.2
postgres: ^3.3.4 postgres: ^3.3.4
qrcode: ^1.5.1 qrcode: ^1.5.1
@ -38,12 +36,10 @@ dependencies:
emoji-regex: 10.2.1 emoji-regex: 10.2.1
file-type: 18.2.1 file-type: 18.2.1
format-duration: 3.0.2 format-duration: 3.0.2
image-size: 1.0.2
jsqr: 1.4.0 jsqr: 1.4.0
matrix-js-sdk: 23.4.0 matrix-js-sdk: 23.4.0
node-addon-api: 5.1.0 node-addon-api: 5.1.0
node-emoji: 1.11.0 node-emoji: 1.11.0
oceanic.js: 1.5.1_bufferutil@4.0.7
qrcode: 1.5.1 qrcode: 1.5.1
sharp: 0.31.3 sharp: 0.31.3
shoukaku: 3.3.1_bufferutil@4.0.7 shoukaku: 3.3.1_bufferutil@4.0.7
@ -400,26 +396,6 @@ packages:
kuler: 2.0.0 kuler: 2.0.0
dev: false 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: /@eslint-community/eslint-utils/4.2.0_eslint@8.35.0:
resolution: {integrity: sha512-gB8T4H4DEfX2IV9zGDJPOBgP1e/DbfCPDTtEqUMckpvzS1OYtva8JdFYBqMwYk7xAQ429WGF/UPqn8uQ//h2vQ==} resolution: {integrity: sha512-gB8T4H4DEfX2IV9zGDJPOBgP1e/DbfCPDTtEqUMckpvzS1OYtva8JdFYBqMwYk7xAQ429WGF/UPqn8uQ//h2vQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@ -656,11 +632,6 @@ packages:
resolution: {integrity: sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==} resolution: {integrity: sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==}
dev: false dev: false
/@types/node/18.14.6:
resolution: {integrity: sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==}
dev: false
optional: true
/@types/normalize-package-data/2.4.1: /@types/normalize-package-data/2.4.1:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
dev: true dev: true
@ -673,13 +644,6 @@ packages:
resolution: {integrity: sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==} resolution: {integrity: sha512-txGIh+0eDFzKGC25zORnswy+br1Ha7hj5cMVwKIU7+s0U2AxxJru/jZSMU6OC9MJWP6+pc/hc6ZjyZShpsyY2g==}
dev: false 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: /acorn-jsx/5.3.2_acorn@8.8.2:
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
peerDependencies: peerDependencies:
@ -1295,11 +1259,6 @@ packages:
resolution: {integrity: sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==} resolution: {integrity: sha512-QV6PMaHTCNmKSeP6QoXhVTw9snc9VD8MulTT0Bd99Pacp4SS1cjcrYPgBPmibqKVtMJJfqC6XvOXgPMEEPH/fg==}
dev: false dev: false
/discord-api-types/0.37.35:
resolution: {integrity: sha512-iyKZ/82k7FX3lcmHiAvvWu5TmyfVo78RtghBV/YsehK6CID83k5SI03DKKopBcln+TiEIYw5MGgq7SJXSpNzMg==}
dev: false
optional: true
/doctrine/3.0.0: /doctrine/3.0.0:
resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}
engines: {node: '>=6.0.0'} engines: {node: '>=6.0.0'}
@ -1936,14 +1895,6 @@ packages:
engines: {node: '>= 4'} engines: {node: '>= 4'}
dev: true 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: /import-fresh/3.3.0:
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -2451,23 +2402,6 @@ packages:
engines: {node: '>= 6'} engines: {node: '>= 6'}
dev: false 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: /once/1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
dependencies: dependencies:
@ -2782,25 +2716,6 @@ packages:
engines: {node: '>= 0.8.0'} engines: {node: '>= 0.8.0'}
dev: true 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: /promptly/2.2.0:
resolution: {integrity: sha512-aC9j+BZsRSSzEsXBNBwDnAxujdx19HycZoKgRgzWnS8eOHg1asuf9heuLprfbe739zY3IdUQx+Egv6Jn135WHA==} resolution: {integrity: sha512-aC9j+BZsRSSzEsXBNBwDnAxujdx19HycZoKgRgzWnS8eOHg1asuf9heuLprfbe739zY3IdUQx+Egv6Jn135WHA==}
dependencies: dependencies:
@ -2855,12 +2770,6 @@ packages:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
dev: true 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: /raw-body/2.5.2:
resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==} resolution: {integrity: sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==}
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}