feat: support user-related placeholders in submission templates and standardize display time to Asia/Bangkok timezone
This commit is contained in:
@@ -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";
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user