Manual dtext hyperlinks in tickets

This commit is contained in:
Tarrgon
2025-06-12 08:11:19 -04:00
parent 2d49801a09
commit e6b6b55b7c
+7
View File
@@ -78,6 +78,8 @@ const linkReplacers = [
}
];
const urlRegex = new RegExp('"((?:[\\S]| )+?)":\\[?((?:https?:\\/\\/[\\w\\d.\\/?=#]+)|\\/[\\w\\d.\\/?=#]+)\\]?', 'gi');
const MAX_DESCRIPTION_LENGTH = 500;
export async function ticketUpdateHandler(client: Client, update: string) {
@@ -183,6 +185,11 @@ async function getLinks(input: string, limit: number = Number.MAX_SAFE_INTEGER):
});
}
input = input.replaceAll(urlRegex, (match, group1, group2) => {
if (group2.startsWith('/')) return `[${group1}](${config.E621_BASE_URL}${group2})`;
else return `[${group1}](${group2})`;
});
const values = await Promise.all(checks);
for (const check of values) {