move to node's subpath system

This commit is contained in:
Cynthia Foxwell 2024-08-18 14:40:33 -06:00
parent 5b8a9afbaa
commit ff6a382591
42 changed files with 181 additions and 188 deletions

View file

@ -24,7 +24,6 @@
"dumpy": "github:Cynosphere/dumpy.js", "dumpy": "github:Cynosphere/dumpy.js",
"google-images": "^2.1.0", "google-images": "^2.1.0",
"jimp": "^0.22.7", "jimp": "^0.22.7",
"module-alias": "^2.2.3",
"murmurhash": "^2.0.1", "murmurhash": "^2.0.1",
"node-ffprobe": "^3.0.0", "node-ffprobe": "^3.0.0",
"sharp": "^0.32.0", "sharp": "^0.32.0",
@ -36,10 +35,10 @@
"husky": "^8.0.3", "husky": "^8.0.3",
"prettier": "^2.8.8" "prettier": "^2.8.8"
}, },
"_moduleAliases": { "imports": {
"@": ".", "#root/*": "./*",
"@lib": "src/lib", "#lib/*.js": "./src/lib/*.js",
"@util": "src/util", "#util/*.js": "./src/util/*.js",
"@modules": "src/modules" "#modules/*.js": "./src/modules/*.js"
} }
} }

View file

@ -26,9 +26,6 @@ importers:
jimp: jimp:
specifier: ^0.22.7 specifier: ^0.22.7
version: 0.22.7(encoding@0.1.13) version: 0.22.7(encoding@0.1.13)
module-alias:
specifier: ^2.2.3
version: 2.2.3
murmurhash: murmurhash:
specifier: ^2.0.1 specifier: ^2.0.1
version: 2.0.1 version: 2.0.1
@ -1100,9 +1097,6 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
hasBin: true hasBin: true
module-alias@2.2.3:
resolution: {integrity: sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q==}
ms@2.1.2: ms@2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
@ -2830,8 +2824,6 @@ snapshots:
mkdirp@2.1.6: {} mkdirp@2.1.6: {}
module-alias@2.2.3: {}
ms@2.1.2: {} ms@2.1.2: {}
ms@2.1.3: ms@2.1.3:

View file

@ -1,20 +1,19 @@
require("module-alias/register");
const {Client, Collection, Channel, Permission} = require("@projectdysnomia/dysnomia"); const {Client, Collection, Channel, Permission} = require("@projectdysnomia/dysnomia");
const fs = require("node:fs"); const fs = require("node:fs");
const {resolve} = require("node:path"); const {resolve} = require("node:path");
const sqlite3 = require("sqlite3"); const sqlite3 = require("sqlite3");
const {instead, before} = require("spitroast"); const {instead, before} = require("spitroast");
const config = require("@/config.json"); const config = require("#root/config.json");
const apikeys = require("@/apikeys.json"); const apikeys = require("#root/apikeys.json");
const logger = require("@lib/logger.js"); const logger = require("#lib/logger.js");
const events = require("@lib/events.js"); const events = require("#lib/events.js");
const timer = require("@lib/timer.js"); const timer = require("#lib/timer.js");
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const {APIEndpoints, Intents, ApplicationCommandTypes, GatewayOPCodes} = require("@util/dconstants.js"); const {APIEndpoints, Intents, ApplicationCommandTypes, GatewayOPCodes} = require("#util/dconstants.js");
const bot = new Client(config.token, { const bot = new Client(config.token, {
defaultImageFormat: "png", defaultImageFormat: "png",
@ -56,17 +55,18 @@ global.hf = {
database, database,
}; };
const {formatUsername} = require("@util/misc.js"); const {formatUsername} = require("#util/misc.js");
const CommandDispatcher = require("@lib/commandDispatcher.js"); const CommandDispatcher = require("#lib/commandDispatcher.js");
const {InteractionDispatcher} = require("@lib/interactionDispatcher.js"); const {InteractionDispatcher} = require("#lib/interactionDispatcher.js");
const {hasFlag} = require("@lib/guildSettings.js"); const {hasFlag} = require("#lib/guildSettings.js");
for (const file of fs.readdirSync(resolve(__dirname, "modules"))) { for (const file of fs.readdirSync(resolve(__dirname, "modules"), {withFileTypes: true})) {
if (file.isDirectory()) continue;
try { try {
require(`@modules/${file}`); require(`#modules/${file.name}`);
logger.info("hf:modules", `Loaded module: "${file}"`); logger.info("hf:modules", `Loaded module: "${file.name}"`);
} catch (err) { } catch (err) {
logger.error("hf:modules", `Failed to load "${file}": ${err}`); logger.error("hf:modules", `Failed to load "${file.name}": ${err}`);
} }
} }

View file

@ -1,8 +1,8 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const CATEGORY = "bot"; const CATEGORY = "bot";
const logger = require("@lib/logger.js"); const logger = require("#lib/logger.js");
const guildSettings = require("@lib/guildSettings.js"); const guildSettings = require("#lib/guildSettings.js");
const child_process = require("node:child_process"); const child_process = require("node:child_process");
const {inspect} = require("node:util"); const {inspect} = require("node:util");
@ -46,7 +46,7 @@ reload.category = CATEGORY;
reload.helpText = "Reloads a module."; reload.helpText = "Reloads a module.";
reload.callback = function (msg, line) { reload.callback = function (msg, line) {
try { try {
require.resolve(`@modules/${line}.js`); require.resolve(`#modules/${line}.js`);
} catch (err) { } catch (err) {
if (err.code == "MODULE_NOT_FOUND") { if (err.code == "MODULE_NOT_FOUND") {
return "Module not found."; return "Module not found.";
@ -58,8 +58,8 @@ reload.callback = function (msg, line) {
try { try {
logger.info("hf:modules", `Reloading module: "${line}"`); logger.info("hf:modules", `Reloading module: "${line}"`);
delete require.cache[require.resolve(`@modules/${line}.js`)]; delete require.cache[require.resolve(`#modules/${line}.js`)];
require(`@modules/${line}.js`); require(`#modules/${line}.js`);
return {reaction: "\uD83D\uDC4C"}; return {reaction: "\uD83D\uDC4C"};
} catch (err) { } catch (err) {
logger.info("hf:modules", `Failed to reload "${line}": ${err}`); logger.info("hf:modules", `Failed to reload "${line}": ${err}`);

View file

@ -1,14 +1,14 @@
const {ApplicationCommandOptionTypes, MessageFlags} = require("@util/dconstants.js"); const {ApplicationCommandOptionTypes, MessageFlags} = require("#util/dconstants.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const events = require("@lib/events.js"); const events = require("#lib/events.js");
const {hasFlag} = require("@lib/guildSettings.js"); const {hasFlag} = require("#lib/guildSettings.js");
const REGEX_GITHUB = const REGEX_GITHUB =
/(?:\s|^)(\|\|\s*)?https?:\/\/(www\.)?github\.com\/[a-z0-9-]+\/[a-z0-9-._]+\/blob\/([a-z0-9-_.?&=#/%]*)(\s*\|\|)?/gi; /(?:\s|^)(\|\|\s*)?https?:\/\/(www\.)?github\.com\/[a-z0-9-]+\/[a-z0-9-._]+\/blob\/([a-z0-9-_.?&=#root/%]*)(\s*\|\|)?/gi;
const REGEX_GITLAB = const REGEX_GITLAB =
/(?:\s|^)(\|\|\s*)?https?:\/\/.+?\/[a-z0-9-]+\/[a-z0-9-._]+\/-\/blob\/([a-z0-9-_.?&=#/%]*)(\s*\|\|)?/gi; /(?:\s|^)(\|\|\s*)?https?:\/\/.+?\/[a-z0-9-]+\/[a-z0-9-._]+\/-\/blob\/([a-z0-9-_.?&=#root/%]*)(\s*\|\|)?/gi;
const REGEX_GITEA = const REGEX_GITEA =
/(?:\s|^)(\|\|\s*)?https?:\/\/.+?\/[a-z0-9-]+\/[a-z0-9-._]+\/src\/(branch|commit)\/([a-z0-9-_.?&=#/%]*)(\s*\|\|)?/gi; /(?:\s|^)(\|\|\s*)?https?:\/\/.+?\/[a-z0-9-]+\/[a-z0-9-._]+\/src\/(branch|commit)\/([a-z0-9-_.?&=#root/%]*)(\s*\|\|)?/gi;
const REGEX_SPOILER = /(?:\s|^)\|\|([\s\S]+?)\|\|/; const REGEX_SPOILER = /(?:\s|^)\|\|([\s\S]+?)\|\|/;
function unindent(str) { function unindent(str) {

View file

@ -3,14 +3,14 @@ const {Message} = require("@projectdysnomia/dysnomia");
const fs = require("node:fs"); const fs = require("node:fs");
const httpSignature = require("@peertube/http-signature"); const httpSignature = require("@peertube/http-signature");
const events = require("@lib/events.js"); const events = require("#lib/events.js");
const logger = require("@lib/logger.js"); const logger = require("#lib/logger.js");
const {hasFlag} = require("@lib/guildSettings.js"); const {hasFlag} = require("#lib/guildSettings.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const {MessageFlags, ApplicationCommandOptionTypes, Permissions} = require("@util/dconstants.js"); const {MessageFlags, ApplicationCommandOptionTypes, Permissions} = require("#util/dconstants.js");
const {getUploadLimit} = require("@util/misc.js"); const {getUploadLimit} = require("#util/misc.js");
const {htmlToMarkdown} = require("@util/html.js"); const {htmlToMarkdown} = require("#util/html.js");
const FRIENDLY_USERAGENT = "HiddenPhox/fedimbed (https://gitdab.com/Cynosphere/HiddenPhox)"; const FRIENDLY_USERAGENT = "HiddenPhox/fedimbed (https://gitdab.com/Cynosphere/HiddenPhox)";
@ -83,7 +83,7 @@ async function resolvePlatform(url) {
} }
const keyId = "https://hf.c7.pm/actor#main-key"; const keyId = "https://hf.c7.pm/actor#main-key";
const privKey = fs.readFileSync(require.resolve("@/priv/private.pem")); const privKey = fs.readFileSync(require.resolve("#root/priv/private.pem"));
async function signedFetch(url, options) { async function signedFetch(url, options) {
const urlObj = new URL(url); const urlObj = new URL(url);
@ -305,7 +305,7 @@ async function processUrl(msg, url, spoiler = false) {
avatar: postData2.account?.avatar ?? postData2.user?.avatarUrl, avatar: postData2.account?.avatar ?? postData2.user?.avatarUrl,
}; };
timestamp = postData2.created_at ?? postData2.createdAt; timestamp = postData2.created_at ?? postData2.createdAt;
emotes = postData2.emojis.filter((x) => !x.name.endsWith("@.")).map((x) => ({name: `:${x.name}:`, url: x.url})); emotes = postData2.emojis.filter((x) => !x.name.endsWith("#.")).map((x) => ({name: `:${x.name}:`, url: x.url}));
sensitive = postData2.sensitive; sensitive = postData2.sensitive;
const attachments = postData2.media_attachments ?? postData2.files; const attachments = postData2.media_attachments ?? postData2.files;
@ -901,8 +901,8 @@ events.add("messageCreate", "fedimbed", async function (msg) {
.replace(/^\]\(/, "") .replace(/^\]\(/, "")
.replace(/\s*[\S]*?\)$/, "") .replace(/\s*[\S]*?\)$/, "")
.trim() .trim()
.replace("@\u200b", "@") .replace("#\u200b", "#")
.replace("@%E2%80%8B", "@"); .replace("#%E2%80%8B", "#");
let urlObj; let urlObj;
try { try {
urlObj = new URL(url); urlObj = new URL(url);
@ -960,8 +960,8 @@ fedimbedCommand.callback = async function (interaction) {
.replace(/^\]\(/, "") .replace(/^\]\(/, "")
.replace(/\s*[\S]*?\)$/, "") .replace(/\s*[\S]*?\)$/, "")
.trim() .trim()
.replace("@\u200b", "@") .replace("#\u200b", "#")
.replace("@%E2%80%8B", "@"); .replace("#%E2%80%8B", "#");
let urlObj; let urlObj;
try { try {
urlObj = new URL(url); urlObj = new URL(url);

View file

@ -1,11 +1,11 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const events = require("@lib/events.js"); const events = require("#lib/events.js");
const logger = require("@lib/logger.js"); const logger = require("#lib/logger.js");
const {tinycolor} = require("@ctrl/tinycolor"); const {tinycolor} = require("@ctrl/tinycolor");
const {pastelize} = require("@util/misc.js"); const {pastelize} = require("#util/misc.js");
const {createBoardMessage} = require("@util/starboard.js"); const {createBoardMessage} = require("#util/starboard.js");
const CATEGORY = "misc"; const CATEGORY = "misc";
const FOXWELLS_GUILD_ID = "300436792916836352"; const FOXWELLS_GUILD_ID = "300436792916836352";

View file

@ -1,7 +1,7 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const CATEGORY = "general"; const CATEGORY = "general";
const {snowflakeToTimestamp} = require("@util/time.js"); const {snowflakeToTimestamp} = require("#util/time.js");
const help = new Command("help"); const help = new Command("help");
help.category = CATEGORY; help.category = CATEGORY;

View file

@ -1,7 +1,7 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const CATEGORY = "image"; const CATEGORY = "image";
const {getImage} = require("@util/image.js"); const {getImage} = require("#util/image.js");
//const dumpyConvert = require("dumpy").convert; //const dumpyConvert = require("dumpy").convert;
const Jimp = require("jimp"); const Jimp = require("jimp");

View file

@ -1,12 +1,13 @@
const fs = require("node:fs"); const fs = require("node:fs");
const {resolve} = require("node:path"); const {resolve} = require("node:path");
const logger = require("@lib/logger.js"); const logger = require("#lib/logger.js");
for (const file of fs.readdirSync(resolve(__dirname, "misc"))) { for (const file of fs.readdirSync(resolve(__dirname, "misc"), {withFileTypes: true})) {
if (file.isDirectory()) continue;
try { try {
require(`@modules/misc/${file}`); require(`#modules/misc/${file.name}`);
} catch (err) { } catch (err) {
logger.error("hf:modules:misc", `Failed to load "${file}": ${err}`); logger.error("hf:modules:misc", `Failed to load "${file.name}": ${err}`);
} }
} }

View file

@ -1,6 +1,6 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {formatTime} = require("@util/time.js"); const {formatTime} = require("#util/time.js");
const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const anonradio = new Command("anonradio"); const anonradio = new Command("anonradio");

View file

@ -1,14 +1,14 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const {ApplicationCommandOptionTypes} = require("@util/dconstants.js"); const {ApplicationCommandOptionTypes} = require("#util/dconstants.js");
const {safeString} = require("@util/misc.js"); const {safeString} = require("#util/misc.js");
const {tinycolor, random: randomColor} = require("@ctrl/tinycolor"); const {tinycolor, random: randomColor} = require("@ctrl/tinycolor");
const sharp = require("sharp"); const sharp = require("sharp");
const fs = require("node:fs"); const fs = require("node:fs");
const colornamesRaw = fs.readFileSync(require.resolve("@/data/colornames.csv"), "utf8"); const colornamesRaw = fs.readFileSync(require.resolve("#root/data/colornames.csv"), "utf8");
const color = new Command("color"); const color = new Command("color");
color.category = "misc"; color.category = "misc";

View file

@ -1,7 +1,7 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {safeString} = require("@util/misc.js"); const {safeString} = require("#util/misc.js");
const {formatTime} = require("@util/time.js"); const {formatTime} = require("#util/time.js");
const GENERATE_HEADERS = { const GENERATE_HEADERS = {
Accept: "application/json", Accept: "application/json",

View file

@ -1,4 +1,4 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const GoogleImages = require("google-images"); const GoogleImages = require("google-images");

View file

@ -1,5 +1,5 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const logger = require("@lib/logger.js"); const logger = require("#lib/logger.js");
const net = require("node:net"); const net = require("node:net");
const {resolveCname, resolveSrv} = require("node:dns/promises"); const {resolveCname, resolveSrv} = require("node:dns/promises");

View file

@ -1,10 +1,10 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const {ApplicationCommandOptionTypes} = require("@util/dconstants.js"); const {ApplicationCommandOptionTypes} = require("#util/dconstants.js");
const {safeString} = require("@util/misc.js"); const {safeString} = require("#util/misc.js");
const {parseHtmlEntities} = require("@util/html.js"); const {parseHtmlEntities} = require("#util/html.js");
const search = new Command("search"); const search = new Command("search");
search.category = "misc"; search.category = "misc";

View file

@ -1,4 +1,4 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const REGEX_IPV4 = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/; const REGEX_IPV4 = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$/;

View file

@ -1,10 +1,10 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const {ApplicationCommandOptionTypes} = require("@util/dconstants.js"); const {ApplicationCommandOptionTypes} = require("#util/dconstants.js");
const {Icons} = require("@util/constants.js"); const {Icons} = require("#util/constants.js");
const {safeString} = require("@util/misc.js"); const {safeString} = require("#util/misc.js");
const WA_NO_ANSWER = `${Icons.silk.cross} No answer.`; const WA_NO_ANSWER = `${Icons.silk.cross} No answer.`;

View file

@ -1,10 +1,10 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const {ApplicationCommandOptionTypes} = require("@util/dconstants.js"); const {ApplicationCommandOptionTypes} = require("#util/dconstants.js");
const {safeString} = require("@util/misc.js"); const {safeString} = require("#util/misc.js");
const {parseHtmlEntities} = require("@util/html.js"); const {parseHtmlEntities} = require("#util/html.js");
const yt = new Command("youtube"); const yt = new Command("youtube");
yt.addAlias("yt"); yt.addAlias("yt");

View file

@ -1,8 +1,8 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const CATEGORY = "moderation"; const CATEGORY = "moderation";
const {formatUsername} = require("@util/misc.js"); const {formatUsername} = require("#util/misc.js");
const {lookupUser} = require("@util/selection.js"); const {lookupUser} = require("#util/selection.js");
const tidy = new Command("tidy"); const tidy = new Command("tidy");
tidy.addAlias("prune"); tidy.addAlias("prune");

View file

@ -3,12 +3,12 @@ const {Collection} = require("@projectdysnomia/dysnomia");
const {Readable} = require("node:stream"); const {Readable} = require("node:stream");
const ffprobe = require("node-ffprobe"); const ffprobe = require("node-ffprobe");
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {formatUsername} = require("@util/misc.js"); const {formatUsername} = require("#util/misc.js");
const {formatTime} = require("@util/time.js"); const {formatTime} = require("#util/time.js");
const {parseHtmlEntities} = require("@util/html.js"); const {parseHtmlEntities} = require("#util/html.js");
const {selectionMessage} = require("@util/selection.js"); const {selectionMessage} = require("#util/selection.js");
const REGEX_YOUTUBE = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/; const REGEX_YOUTUBE = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/;
const REGEX_YOUTUBE_PLAYLIST = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/playlist\?list=(.+)$/; const REGEX_YOUTUBE_PLAYLIST = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/playlist\?list=(.+)$/;

View file

@ -10,15 +10,15 @@ private_reminders.json example:
] ]
*/ */
const timer = require("@lib/timer"); const timer = require("#lib/timer.js");
const logger = require("@lib/logger"); const logger = require("#lib/logger.js");
const tzFormatterCache = {}; const tzFormatterCache = {};
const dmCache = {}; const dmCache = {};
let reminderData; let reminderData;
try { try {
reminderData = require("@/private_reminders.json"); reminderData = require("#root/private_reminders.json");
} catch { } catch {
return; return;
} }

View file

@ -1,6 +1,6 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {selectionMessage} = require("@util/selection.js"); const {selectionMessage} = require("#util/selection.js");
hf.database.run( hf.database.run(
"CREATE TABLE IF NOT EXISTS roleme (guild TEXT NOT NULL PRIMARY KEY, roles TEXT NOT NULL) WITHOUT ROWID" "CREATE TABLE IF NOT EXISTS roleme (guild TEXT NOT NULL PRIMARY KEY, roles TEXT NOT NULL) WITHOUT ROWID"

View file

@ -1,12 +1,13 @@
const fs = require("node:fs"); const fs = require("node:fs");
const {resolve} = require("node:path"); const {resolve} = require("node:path");
const logger = require("@lib/logger.js"); const logger = require("#lib/logger.js");
for (const file of fs.readdirSync(resolve(__dirname, "utility"))) { for (const file of fs.readdirSync(resolve(__dirname, "utility"), {withFileTypes: true})) {
if (file.isDirectory()) continue;
try { try {
require(`@modules/utility/${file}`); require(`#modules/utility/${file.name}`);
} catch (err) { } catch (err) {
logger.error("hf:modules:utility", `Failed to load "${file}": ${err}`); logger.error("hf:modules:utility", `Failed to load "${file.name}": ${err}`);
} }
} }

View file

@ -1,5 +1,5 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const { const {
APIEndpoints, APIEndpoints,
@ -8,14 +8,14 @@ const {
ApplicationTypes, ApplicationTypes,
CDNEndpoints, CDNEndpoints,
Games, Games,
} = require("@util/dconstants.js"); } = require("#util/dconstants.js");
const { const {
ApplicationFlagNames, ApplicationFlagNames,
Icons, Icons,
RegExp: {Snowflake: SNOWFLAKE_REGEX}, RegExp: {Snowflake: SNOWFLAKE_REGEX},
} = require("@util/constants.js"); } = require("#util/constants.js");
const {snowflakeToTimestamp} = require("@util/time.js"); const {snowflakeToTimestamp} = require("#util/time.js");
const {getGuild, safeString, formatUsername, flagsFromInt} = require("@util/misc.js"); const {getGuild, safeString, formatUsername, flagsFromInt} = require("#util/misc.js");
const appinfo = new Command("appinfo"); const appinfo = new Command("appinfo");
appinfo.category = "utility"; appinfo.category = "utility";

View file

@ -1,10 +1,10 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {APIEndpoints, CDNEndpoints} = require("@util/dconstants.js"); const {APIEndpoints, CDNEndpoints} = require("#util/dconstants.js");
const {Icons} = require("@util/constants.js"); const {Icons} = require("#util/constants.js");
const {formatUsername, getDefaultAvatar} = require("@util/misc.js"); const {formatUsername, getDefaultAvatar} = require("#util/misc.js");
const {lookupUser} = require("@util/selection.js"); const {lookupUser} = require("#util/selection.js");
const avatar = new Command("avatar"); const avatar = new Command("avatar");
avatar.category = "utility"; avatar.category = "utility";

View file

@ -1,9 +1,9 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {APIEndpoints, CDNEndpoints} = require("@util/dconstants.js"); const {APIEndpoints, CDNEndpoints} = require("#util/dconstants.js");
const {formatUsername} = require("@util/misc.js"); const {formatUsername} = require("#util/misc.js");
const {lookupUser} = require("@util/selection.js"); const {lookupUser} = require("#util/selection.js");
const banner = new Command("banner"); const banner = new Command("banner");
banner.category = "utility"; banner.category = "utility";

View file

@ -1,8 +1,8 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const {ApplicationCommandOptionTypes} = require("@util/dconstants.js"); const {ApplicationCommandOptionTypes} = require("#util/dconstants.js");
const {getNamesFromString} = require("@util/unicode.js"); const {getNamesFromString} = require("#util/unicode.js");
const charinfo = new Command("charinfo"); const charinfo = new Command("charinfo");
charinfo.category = "utility"; charinfo.category = "utility";

View file

@ -1,9 +1,9 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {APIEndpoints, CDNEndpoints} = require("@util/dconstants.js"); const {APIEndpoints, CDNEndpoints} = require("#util/dconstants.js");
const {formatUsername} = require("@util/misc.js"); const {formatUsername} = require("#util/misc.js");
const {lookupUser} = require("@util/selection.js"); const {lookupUser} = require("#util/selection.js");
const decoration = new Command("decoration"); const decoration = new Command("decoration");
decoration.category = "utility"; decoration.category = "utility";

View file

@ -1,10 +1,10 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {APIEndpoints, UserFlags} = require("@util/dconstants.js"); const {APIEndpoints, UserFlags} = require("#util/dconstants.js");
const { const {
RegExp: {Snowflake: SNOWFLAKE_REGEX}, RegExp: {Snowflake: SNOWFLAKE_REGEX},
} = require("@util/constants.js"); } = require("#util/constants.js");
const {flagsFromInt, formatUsername} = require("@util/misc.js"); const {flagsFromInt, formatUsername} = require("#util/misc.js");
const _UserFlags = Object.entries(UserFlags).filter(([name]) => name != "NONE"); const _UserFlags = Object.entries(UserFlags).filter(([name]) => name != "NONE");
for (const set of _UserFlags) { for (const set of _UserFlags) {

View file

@ -1,5 +1,5 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const {VoiceChannel} = require("@projectdysnomia/dysnomia"); const {VoiceChannel} = require("@projectdysnomia/dysnomia");
@ -12,14 +12,14 @@ const {
Games, Games,
Permissions, Permissions,
VerificationLevelStrings, VerificationLevelStrings,
} = require("@util/dconstants.js"); } = require("#util/dconstants.js");
const { const {
RegExp: {Snowflake: SNOWFLAKE_REGEX}, RegExp: {Snowflake: SNOWFLAKE_REGEX},
Icons, Icons,
ChannelTypeNames, ChannelTypeNames,
} = require("@util/constants.js"); } = require("#util/constants.js");
const {snowflakeToTimestamp} = require("@util/time.js"); const {snowflakeToTimestamp} = require("#util/time.js");
const {getGuild, tryGetGuild, formatGuildFeatures} = require("@util/misc.js"); const {getGuild, tryGetGuild, formatGuildFeatures} = require("#util/misc.js");
const guildinfo = new Command("guildinfo"); const guildinfo = new Command("guildinfo");
guildinfo.category = "utility"; guildinfo.category = "utility";

View file

@ -1,5 +1,5 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const sharp = require("sharp"); const sharp = require("sharp");
@ -7,9 +7,9 @@ const {
RegExp: {Emote: CUSTOM_EMOTE_REGEX}, RegExp: {Emote: CUSTOM_EMOTE_REGEX},
EmojiSets, EmojiSets,
EmojiNames, EmojiNames,
} = require("@util/constants.js"); } = require("#util/constants.js");
const {ApplicationCommandOptionTypes, CDNEndpoints} = require("@util/dconstants.js"); const {ApplicationCommandOptionTypes, CDNEndpoints} = require("#util/dconstants.js");
const {getNamesFromString} = require("@util/unicode.js"); const {getNamesFromString} = require("#util/unicode.js");
const jumbo = new Command("jumbo"); const jumbo = new Command("jumbo");
jumbo.category = "utility"; jumbo.category = "utility";

View file

@ -1,16 +1,16 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const { const {
APIEndpoints, APIEndpoints,
ApplicationCommandOptionTypes, ApplicationCommandOptionTypes,
CDNEndpoints, CDNEndpoints,
DEFAULT_GROUP_DM_AVATARS, DEFAULT_GROUP_DM_AVATARS,
} = require("@util/dconstants.js"); } = require("#util/dconstants.js");
const {Icons} = require("@util/constants.js"); const {Icons} = require("#util/constants.js");
const {formatUsername, safeString, formatGuildFeatures} = require("@util/misc.js"); const {formatUsername, safeString, formatGuildFeatures} = require("#util/misc.js");
const {snowflakeToTimestamp} = require("@util/time.js"); const {snowflakeToTimestamp} = require("#util/time.js");
const lookupinvite = new Command("lookupinvite"); const lookupinvite = new Command("lookupinvite");
lookupinvite.category = "utility"; lookupinvite.category = "utility";

View file

@ -1,9 +1,9 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {APIEndpoints} = require("@util/dconstants.js"); const {APIEndpoints} = require("#util/dconstants.js");
const { const {
RegExp: {Pomelo: POMELO_REGEX}, RegExp: {Pomelo: POMELO_REGEX},
} = require("@util/constants.js"); } = require("#util/constants.js");
const pomelo = new Command("pomelo"); const pomelo = new Command("pomelo");
pomelo.category = "utility"; pomelo.category = "utility";

View file

@ -1,12 +1,12 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const sharp = require("sharp"); const sharp = require("sharp");
const {ActivityTypeNames, CDNEndpoints, Games, HangStatusStrings, HANG_STATUS_ICONS} = require("@util/dconstants.js"); const {ActivityTypeNames, CDNEndpoints, Games, HangStatusStrings, HANG_STATUS_ICONS} = require("#util/dconstants.js");
const {Icons} = require("@util/constants.js"); const {Icons} = require("#util/constants.js");
const {formatUsername} = require("@util/misc.js"); const {formatUsername} = require("#util/misc.js");
const {lookupUser} = require("@util/selection.js"); const {lookupUser} = require("#util/selection.js");
const {formatTime} = require("@util/time.js"); const {formatTime} = require("#util/time.js");
const HangStatusImages = {}; const HangStatusImages = {};
(async () => { (async () => {

View file

@ -1,6 +1,6 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const {snowflakeToTimestamp} = require("@util/time.js"); const {snowflakeToTimestamp} = require("#util/time.js");
const snowflake = new Command("snowflake"); const snowflake = new Command("snowflake");
snowflake.category = "utility"; snowflake.category = "utility";

View file

@ -1,5 +1,5 @@
const Command = require("@lib/command.js"); const Command = require("#lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js"); const InteractionCommand = require("#lib/interactionCommand.js");
const { const {
ActivityTypeNames, ActivityTypeNames,
@ -10,12 +10,12 @@ const {
CDNEndpoints, CDNEndpoints,
ClanPlaystyle, ClanPlaystyle,
UserFlags, UserFlags,
} = require("@util/dconstants.js"); } = require("#util/dconstants.js");
const {Icons} = require("@util/constants.js"); const {Icons} = require("#util/constants.js");
const {formatUsername, getDefaultAvatar, getTopColor, pastelize} = require("@util/misc.js"); const {formatUsername, getDefaultAvatar, getTopColor, pastelize} = require("#util/misc.js");
const {snowflakeToTimestamp} = require("@util/time.js"); const {snowflakeToTimestamp} = require("#util/time.js");
const {lookupUser} = require("@util/selection.js"); const {lookupUser} = require("#util/selection.js");
const ONE_MONTH = 2628000; const ONE_MONTH = 2628000;

View file

@ -546,7 +546,7 @@ EMOJI_SETS.twitter = EMOJI_SETS.twemoji;
//EMOJI_SETS.fb = EMOJI_SETS.facebook; //EMOJI_SETS.fb = EMOJI_SETS.facebook;
module.exports.EmojiSets = EMOJI_SETS; module.exports.EmojiSets = EMOJI_SETS;
const EmojiData = require("@/data/emoji.json"); const EmojiData = require("#root/data/emoji.json");
const EMOJI_NAMES = []; const EMOJI_NAMES = [];
for (const emoji of EmojiData) { for (const emoji of EmojiData) {
EMOJI_NAMES[emoji.char] = emoji.name.replace(/ /g, "_"); EMOJI_NAMES[emoji.char] = emoji.name.replace(/ /g, "_");

View file

@ -130,7 +130,7 @@ module.exports.DEFAULT_GROUP_DM_AVATARS = [
module.exports.ExplicitContentFilterStrings = ["Disabled", "Members without roles", "All members"]; module.exports.ExplicitContentFilterStrings = ["Disabled", "Members without roles", "All members"];
module.exports.Games = require("@/data/games.json"); module.exports.Games = require("#root/data/games.json");
module.exports.HANG_STATUS_ICONS = Object.fromEntries( module.exports.HANG_STATUS_ICONS = Object.fromEntries(
Object.entries({ Object.entries({

View file

@ -2,7 +2,7 @@ const murmurhash = require("murmurhash").v3;
const {tinycolor} = require("@ctrl/tinycolor"); const {tinycolor} = require("@ctrl/tinycolor");
const {APIEndpoints, CDNEndpoints, UPLOAD_LIMIT, UPLOAD_LIMIT_TIER_2, UPLOAD_LIMIT_TIER_3} = require("./dconstants.js"); const {APIEndpoints, CDNEndpoints, UPLOAD_LIMIT, UPLOAD_LIMIT_TIER_2, UPLOAD_LIMIT_TIER_3} = require("./dconstants.js");
const {GuildFeaturesFormatted, Icons} = require("@util/constants.js"); const {GuildFeaturesFormatted, Icons} = require("#util/constants.js");
function pastelize(id) { function pastelize(id) {
const hue = murmurhash(id) % 360; const hue = murmurhash(id) % 360;
@ -35,7 +35,7 @@ function safeString(string, newLines = true) {
string = string ? string.toString() : ""; string = string ? string.toString() : "";
string = string.replace(/`/g, "'"); string = string.replace(/`/g, "'");
string = string.replace(/<@/g, "<@\u200b"); string = string.replace(/<@/g, "<@\u200b");
string = string.replace(/<#/g, "<#\u200b"); string = string.replace(/<#root/g, "<#\u200b");
string = string.replace(/<&/g, "<&\u200b"); string = string.replace(/<&/g, "<&\u200b");
if (newLines) string = string.replace(/\n/g, " "); if (newLines) string = string.replace(/\n/g, " ");
return string; return string;

View file

@ -1,11 +1,11 @@
const {Collection} = require("@projectdysnomia/dysnomia"); const {Collection} = require("@projectdysnomia/dysnomia");
const logger = require("@lib/logger.js"); const logger = require("#lib/logger.js");
const {formatUsername} = require("@util/misc.js"); const {formatUsername} = require("#util/misc.js");
const {APIEndpoints} = require("@util/dconstants.js"); const {APIEndpoints} = require("#util/dconstants.js");
const { const {
RegExp: {Snowflake: REGEX_SNOWFLAKE}, RegExp: {Snowflake: REGEX_SNOWFLAKE},
} = require("@util/constants.js"); } = require("#util/constants.js");
if (!hf.selectionMessages) hf.selectionMessages = new Collection(); if (!hf.selectionMessages) hf.selectionMessages = new Collection();
async function selectionMessage(msg, heading, options, timeout = 30000, maxItems = 1) { async function selectionMessage(msg, heading, options, timeout = 30000, maxItems = 1) {

View file

@ -1,5 +1,5 @@
const {pastelize} = require("@util/misc.js"); const {pastelize} = require("#util/misc.js");
const {findSuitableImage} = require("@util/image.js"); const {findSuitableImage} = require("#util/image.js");
async function createBoardMessage(msg, count, threadId = null, fetchAttachment = true) { async function createBoardMessage(msg, count, threadId = null, fetchAttachment = true) {
const name = msg.member?.nick ?? msg.author.globalName ?? msg.author.username; const name = msg.member?.nick ?? msg.author.globalName ?? msg.author.username;