Add github webhook and mapping

This commit is contained in:
Tarrgon
2025-06-22 08:15:03 -04:00
parent 5dc38227a1
commit 8ddfbed396
12 changed files with 212 additions and 7 deletions
+13
View File
@@ -0,0 +1,13 @@
import { Database } from '../shared/Database';
const mentionRegex = new RegExp('@([\\S]+)', 'gi');
export async function fixPings(body: string): Promise<string> {
const mappings = await Database.getAllGithubUserMappings();
return body.replaceAll(mentionRegex, (match, username) => {
const mapping = mappings.find(m => m.github_username == username);
return mapping ? `<@${mapping.discord_id}>` : match;
});
}