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

View file

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

View file

@ -1,20 +1,19 @@
require("module-alias/register");
const {Client, Collection, Channel, Permission} = require("@projectdysnomia/dysnomia");
const fs = require("node:fs");
const {resolve} = require("node:path");
const sqlite3 = require("sqlite3");
const {instead, before} = require("spitroast");
const config = require("@/config.json");
const apikeys = require("@/apikeys.json");
const config = require("#root/config.json");
const apikeys = require("#root/apikeys.json");
const logger = require("@lib/logger.js");
const events = require("@lib/events.js");
const timer = require("@lib/timer.js");
const Command = require("@lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const logger = require("#lib/logger.js");
const events = require("#lib/events.js");
const timer = require("#lib/timer.js");
const Command = require("#lib/command.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, {
defaultImageFormat: "png",
@ -56,17 +55,18 @@ global.hf = {
database,
};
const {formatUsername} = require("@util/misc.js");
const CommandDispatcher = require("@lib/commandDispatcher.js");
const {InteractionDispatcher} = require("@lib/interactionDispatcher.js");
const {hasFlag} = require("@lib/guildSettings.js");
const {formatUsername} = require("#util/misc.js");
const CommandDispatcher = require("#lib/commandDispatcher.js");
const {InteractionDispatcher} = require("#lib/interactionDispatcher.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 {
require(`@modules/${file}`);
logger.info("hf:modules", `Loaded module: "${file}"`);
require(`#modules/${file.name}`);
logger.info("hf:modules", `Loaded module: "${file.name}"`);
} 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 logger = require("@lib/logger.js");
const guildSettings = require("@lib/guildSettings.js");
const logger = require("#lib/logger.js");
const guildSettings = require("#lib/guildSettings.js");
const child_process = require("node:child_process");
const {inspect} = require("node:util");
@ -46,7 +46,7 @@ reload.category = CATEGORY;
reload.helpText = "Reloads a module.";
reload.callback = function (msg, line) {
try {
require.resolve(`@modules/${line}.js`);
require.resolve(`#modules/${line}.js`);
} catch (err) {
if (err.code == "MODULE_NOT_FOUND") {
return "Module not found.";
@ -58,8 +58,8 @@ reload.callback = function (msg, line) {
try {
logger.info("hf:modules", `Reloading module: "${line}"`);
delete require.cache[require.resolve(`@modules/${line}.js`)];
require(`@modules/${line}.js`);
delete require.cache[require.resolve(`#modules/${line}.js`)];
require(`#modules/${line}.js`);
return {reaction: "\uD83D\uDC4C"};
} catch (err) {
logger.info("hf:modules", `Failed to reload "${line}": ${err}`);

View file

@ -1,14 +1,14 @@
const {ApplicationCommandOptionTypes, MessageFlags} = require("@util/dconstants.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const {ApplicationCommandOptionTypes, MessageFlags} = require("#util/dconstants.js");
const InteractionCommand = require("#lib/interactionCommand.js");
const events = require("@lib/events.js");
const {hasFlag} = require("@lib/guildSettings.js");
const events = require("#lib/events.js");
const {hasFlag} = require("#lib/guildSettings.js");
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 =
/(?:\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 =
/(?:\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]+?)\|\|/;
function unindent(str) {

View file

@ -3,14 +3,14 @@ const {Message} = require("@projectdysnomia/dysnomia");
const fs = require("node:fs");
const httpSignature = require("@peertube/http-signature");
const events = require("@lib/events.js");
const logger = require("@lib/logger.js");
const {hasFlag} = require("@lib/guildSettings.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const events = require("#lib/events.js");
const logger = require("#lib/logger.js");
const {hasFlag} = require("#lib/guildSettings.js");
const InteractionCommand = require("#lib/interactionCommand.js");
const {MessageFlags, ApplicationCommandOptionTypes, Permissions} = require("@util/dconstants.js");
const {getUploadLimit} = require("@util/misc.js");
const {htmlToMarkdown} = require("@util/html.js");
const {MessageFlags, ApplicationCommandOptionTypes, Permissions} = require("#util/dconstants.js");
const {getUploadLimit} = require("#util/misc.js");
const {htmlToMarkdown} = require("#util/html.js");
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 privKey = fs.readFileSync(require.resolve("@/priv/private.pem"));
const privKey = fs.readFileSync(require.resolve("#root/priv/private.pem"));
async function signedFetch(url, options) {
const urlObj = new URL(url);
@ -305,7 +305,7 @@ async function processUrl(msg, url, spoiler = false) {
avatar: postData2.account?.avatar ?? postData2.user?.avatarUrl,
};
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;
const attachments = postData2.media_attachments ?? postData2.files;
@ -901,8 +901,8 @@ events.add("messageCreate", "fedimbed", async function (msg) {
.replace(/^\]\(/, "")
.replace(/\s*[\S]*?\)$/, "")
.trim()
.replace("@\u200b", "@")
.replace("@%E2%80%8B", "@");
.replace("#\u200b", "#")
.replace("#%E2%80%8B", "#");
let urlObj;
try {
urlObj = new URL(url);
@ -960,8 +960,8 @@ fedimbedCommand.callback = async function (interaction) {
.replace(/^\]\(/, "")
.replace(/\s*[\S]*?\)$/, "")
.trim()
.replace("@\u200b", "@")
.replace("@%E2%80%8B", "@");
.replace("#\u200b", "#")
.replace("#%E2%80%8B", "#");
let urlObj;
try {
urlObj = new URL(url);

View file

@ -1,11 +1,11 @@
const Command = require("@lib/command.js");
const events = require("@lib/events.js");
const logger = require("@lib/logger.js");
const Command = require("#lib/command.js");
const events = require("#lib/events.js");
const logger = require("#lib/logger.js");
const {tinycolor} = require("@ctrl/tinycolor");
const {pastelize} = require("@util/misc.js");
const {createBoardMessage} = require("@util/starboard.js");
const {pastelize} = require("#util/misc.js");
const {createBoardMessage} = require("#util/starboard.js");
const CATEGORY = "misc";
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 {snowflakeToTimestamp} = require("@util/time.js");
const {snowflakeToTimestamp} = require("#util/time.js");
const help = new Command("help");
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 {getImage} = require("@util/image.js");
const {getImage} = require("#util/image.js");
//const dumpyConvert = require("dumpy").convert;
const Jimp = require("jimp");

View file

@ -1,12 +1,13 @@
const fs = require("node:fs");
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 {
require(`@modules/misc/${file}`);
require(`#modules/misc/${file.name}`);
} 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 anonradio = new Command("anonradio");

View file

@ -1,14 +1,14 @@
const Command = require("@lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const {ApplicationCommandOptionTypes} = require("@util/dconstants.js");
const Command = require("#lib/command.js");
const InteractionCommand = require("#lib/interactionCommand.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 sharp = require("sharp");
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");
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 {formatTime} = require("@util/time.js");
const {safeString} = require("#util/misc.js");
const {formatTime} = require("#util/time.js");
const GENERATE_HEADERS = {
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");

View file

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

View file

@ -1,10 +1,10 @@
const Command = require("@lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const Command = require("#lib/command.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 {parseHtmlEntities} = require("@util/html.js");
const {safeString} = require("#util/misc.js");
const {parseHtmlEntities} = require("#util/html.js");
const search = new Command("search");
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}$/;

View file

@ -1,10 +1,10 @@
const Command = require("@lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const Command = require("#lib/command.js");
const InteractionCommand = require("#lib/interactionCommand.js");
const {ApplicationCommandOptionTypes} = require("@util/dconstants.js");
const {Icons} = require("@util/constants.js");
const {ApplicationCommandOptionTypes} = require("#util/dconstants.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.`;

View file

@ -1,10 +1,10 @@
const Command = require("@lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const Command = require("#lib/command.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 {parseHtmlEntities} = require("@util/html.js");
const {safeString} = require("#util/misc.js");
const {parseHtmlEntities} = require("#util/html.js");
const yt = new Command("youtube");
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 {formatUsername} = require("@util/misc.js");
const {lookupUser} = require("@util/selection.js");
const {formatUsername} = require("#util/misc.js");
const {lookupUser} = require("#util/selection.js");
const tidy = new Command("tidy");
tidy.addAlias("prune");

View file

@ -3,12 +3,12 @@ const {Collection} = require("@projectdysnomia/dysnomia");
const {Readable} = require("node:stream");
const ffprobe = require("node-ffprobe");
const Command = require("@lib/command.js");
const Command = require("#lib/command.js");
const {formatUsername} = require("@util/misc.js");
const {formatTime} = require("@util/time.js");
const {parseHtmlEntities} = require("@util/html.js");
const {selectionMessage} = require("@util/selection.js");
const {formatUsername} = require("#util/misc.js");
const {formatTime} = require("#util/time.js");
const {parseHtmlEntities} = require("#util/html.js");
const {selectionMessage} = require("#util/selection.js");
const REGEX_YOUTUBE = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$/;
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 logger = require("@lib/logger");
const timer = require("#lib/timer.js");
const logger = require("#lib/logger.js");
const tzFormatterCache = {};
const dmCache = {};
let reminderData;
try {
reminderData = require("@/private_reminders.json");
reminderData = require("#root/private_reminders.json");
} catch {
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(
"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 {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 {
require(`@modules/utility/${file}`);
require(`#modules/utility/${file.name}`);
} 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 InteractionCommand = require("@lib/interactionCommand.js");
const Command = require("#lib/command.js");
const InteractionCommand = require("#lib/interactionCommand.js");
const {
APIEndpoints,
@ -8,14 +8,14 @@ const {
ApplicationTypes,
CDNEndpoints,
Games,
} = require("@util/dconstants.js");
} = require("#util/dconstants.js");
const {
ApplicationFlagNames,
Icons,
RegExp: {Snowflake: SNOWFLAKE_REGEX},
} = require("@util/constants.js");
const {snowflakeToTimestamp} = require("@util/time.js");
const {getGuild, safeString, formatUsername, flagsFromInt} = require("@util/misc.js");
} = require("#util/constants.js");
const {snowflakeToTimestamp} = require("#util/time.js");
const {getGuild, safeString, formatUsername, flagsFromInt} = require("#util/misc.js");
const appinfo = new Command("appinfo");
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 {Icons} = require("@util/constants.js");
const {APIEndpoints, CDNEndpoints} = require("#util/dconstants.js");
const {Icons} = require("#util/constants.js");
const {formatUsername, getDefaultAvatar} = require("@util/misc.js");
const {lookupUser} = require("@util/selection.js");
const {formatUsername, getDefaultAvatar} = require("#util/misc.js");
const {lookupUser} = require("#util/selection.js");
const avatar = new Command("avatar");
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 {lookupUser} = require("@util/selection.js");
const {formatUsername} = require("#util/misc.js");
const {lookupUser} = require("#util/selection.js");
const banner = new Command("banner");
banner.category = "utility";

View file

@ -1,8 +1,8 @@
const Command = require("@lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const Command = require("#lib/command.js");
const InteractionCommand = require("#lib/interactionCommand.js");
const {ApplicationCommandOptionTypes} = require("@util/dconstants.js");
const {getNamesFromString} = require("@util/unicode.js");
const {ApplicationCommandOptionTypes} = require("#util/dconstants.js");
const {getNamesFromString} = require("#util/unicode.js");
const charinfo = new Command("charinfo");
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 {lookupUser} = require("@util/selection.js");
const {formatUsername} = require("#util/misc.js");
const {lookupUser} = require("#util/selection.js");
const decoration = new Command("decoration");
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 {
RegExp: {Snowflake: SNOWFLAKE_REGEX},
} = require("@util/constants.js");
const {flagsFromInt, formatUsername} = require("@util/misc.js");
} = require("#util/constants.js");
const {flagsFromInt, formatUsername} = require("#util/misc.js");
const _UserFlags = Object.entries(UserFlags).filter(([name]) => name != "NONE");
for (const set of _UserFlags) {

View file

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

View file

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

View file

@ -1,16 +1,16 @@
const Command = require("@lib/command.js");
const InteractionCommand = require("@lib/interactionCommand.js");
const Command = require("#lib/command.js");
const InteractionCommand = require("#lib/interactionCommand.js");
const {
APIEndpoints,
ApplicationCommandOptionTypes,
CDNEndpoints,
DEFAULT_GROUP_DM_AVATARS,
} = require("@util/dconstants.js");
const {Icons} = require("@util/constants.js");
} = require("#util/dconstants.js");
const {Icons} = require("#util/constants.js");
const {formatUsername, safeString, formatGuildFeatures} = require("@util/misc.js");
const {snowflakeToTimestamp} = require("@util/time.js");
const {formatUsername, safeString, formatGuildFeatures} = require("#util/misc.js");
const {snowflakeToTimestamp} = require("#util/time.js");
const lookupinvite = new Command("lookupinvite");
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 {
RegExp: {Pomelo: POMELO_REGEX},
} = require("@util/constants.js");
} = require("#util/constants.js");
const pomelo = new Command("pomelo");
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 {ActivityTypeNames, CDNEndpoints, Games, HangStatusStrings, HANG_STATUS_ICONS} = require("@util/dconstants.js");
const {Icons} = require("@util/constants.js");
const {formatUsername} = require("@util/misc.js");
const {lookupUser} = require("@util/selection.js");
const {formatTime} = require("@util/time.js");
const {ActivityTypeNames, CDNEndpoints, Games, HangStatusStrings, HANG_STATUS_ICONS} = require("#util/dconstants.js");
const {Icons} = require("#util/constants.js");
const {formatUsername} = require("#util/misc.js");
const {lookupUser} = require("#util/selection.js");
const {formatTime} = require("#util/time.js");
const HangStatusImages = {};
(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");
snowflake.category = "utility";

View file

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

View file

@ -546,7 +546,7 @@ EMOJI_SETS.twitter = EMOJI_SETS.twemoji;
//EMOJI_SETS.fb = EMOJI_SETS.facebook;
module.exports.EmojiSets = EMOJI_SETS;
const EmojiData = require("@/data/emoji.json");
const EmojiData = require("#root/data/emoji.json");
const EMOJI_NAMES = [];
for (const emoji of EmojiData) {
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.Games = require("@/data/games.json");
module.exports.Games = require("#root/data/games.json");
module.exports.HANG_STATUS_ICONS = Object.fromEntries(
Object.entries({

View file

@ -2,7 +2,7 @@ const murmurhash = require("murmurhash").v3;
const {tinycolor} = require("@ctrl/tinycolor");
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) {
const hue = murmurhash(id) % 360;
@ -35,7 +35,7 @@ function safeString(string, newLines = true) {
string = string ? string.toString() : "";
string = string.replace(/`/g, "'");
string = string.replace(/<@/g, "<@\u200b");
string = string.replace(/<#/g, "<#\u200b");
string = string.replace(/<#root/g, "<#\u200b");
string = string.replace(/<&/g, "<&\u200b");
if (newLines) string = string.replace(/\n/g, " ");
return string;

View file

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

View file

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