feat: support user-related placeholders in submission templates and standardize display time to Asia/Bangkok timezone

This commit is contained in:
2026-06-29 20:30:06 +07:00 Unverified
parent 56eaf61cef
commit f9b423eded
4 changed files with 14 additions and 7 deletions
+8 -1
View File
@@ -113,8 +113,15 @@ export async function submitForm(
}, {} as Record<string, string>);
let message = templateToUse;
// Replace {1}, {2}, etc. with value
// Replace {1}, {2}, etc. with value, and new variables
message = message.replace(/\{([^}]+)\}/g, (match: string, p1: string) => {
const key = p1.toLowerCase();
if (key === "username" || key === "displayname") {
return session.user?.name || "Unknown User";
}
if (key === "id") {
return discordId || "Unknown ID";
}
return answersDict[p1] || "Not Provided";
});