diff --git a/src/modules/utility.js b/src/modules/utility.js index 4655256..7740192 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -60,7 +60,7 @@ const CUSTOM_EMOTE_REGEX = /<(?:\u200b|&)?(a)?:(\w+):(\d+)>/; const fetch = require("node-fetch"); const sharp = require("sharp"); -const {lookupUser} = require("../lib/utils.js"); +const {hastebin, lookupUser} = require("../lib/utils.js"); const {getNamesFromString} = require("../lib/unicode.js"); const avatar = new Command("avatar"); @@ -576,3 +576,28 @@ jumbo.callback = async function (msg, line) { } }; hf.registerCommand(jumbo); + +const charinfo = new Command("charinfo"); +charinfo.category = CATEGORY; +charinfo.description = "Get information about a set of characters."; +charinfo.usage = "[characters]"; +charinfo.addAlias("char"); +charinfo.callback = async function (msg, line) { + const names = getNamesFromString(line); + const chars = [...line]; + const lines = names + .map( + ([code, name], index) => + `\`\\u${code}\`: ${name} - ${chars[index]} - ` + ) + .join("\n"); + + if (lines.length > 2000) { + return `Output too long: ${hf.config.haste_provider}/${await hastebin( + lines + )}`; + } else { + return lines; + } +}; +hf.registerCommand(charinfo);