generated from nhcarrigan/template
feat: Update Error Notifications with ComponentsV2 #14
@@ -129,6 +129,10 @@ export const applicationData: Record<string, { name: string; key: string }> = {
|
|||||||
key: "6ca3a85713dba0f9a32eb03f9682ead8e0a5ba9431d105119fd5d4e2776aeb17",
|
key: "6ca3a85713dba0f9a32eb03f9682ead8e0a5ba9431d105119fd5d4e2776aeb17",
|
||||||
name: "Elunara",
|
name: "Elunara",
|
||||||
},
|
},
|
||||||
|
"1411089581058822275": {
|
||||||
|
key: "c37c74a774458d3c54bdd8fa36ffa193dac974c33cafea836cbac826706fa102",
|
||||||
|
name: "Sakura",
|
||||||
|
},
|
||||||
"1412945347134881862": {
|
"1412945347134881862": {
|
||||||
key: "3cee9e358fb0ba1c1e974248395e3cbda936e3ea499c68f8a86a95e07e013aca",
|
key: "3cee9e358fb0ba1c1e974248395e3cbda936e3ea499c68f8a86a95e07e013aca",
|
||||||
name: "Umbrelle",
|
name: "Umbrelle",
|
||||||
@@ -137,32 +141,28 @@ export const applicationData: Record<string, { name: string; key: string }> = {
|
|||||||
key: "11809d144851d8506cbfb5a6dc2738a919d0935c383da785d1ff687887a7cd0a",
|
key: "11809d144851d8506cbfb5a6dc2738a919d0935c383da785d1ff687887a7cd0a",
|
||||||
name: "Tessara",
|
name: "Tessara",
|
||||||
},
|
},
|
||||||
"1459002793179349023": {
|
|
||||||
key: "90ab6b4be1f73708ef46b4f72141dde0254f68124f9642fabedbbfc4618d07cc",
|
|
||||||
name: "Tesseract"
|
|
||||||
},
|
|
||||||
"1459007370746134691": {
|
|
||||||
key: "8082f0f536a0bea6cdd28fab2f6e8451f927858901025b5b5d77fa39b3aaf6c3",
|
|
||||||
name: "Ephemere"
|
|
||||||
},
|
|
||||||
"884082547183747153": {
|
|
||||||
key: "5a73fdbd5fc5b56dbc8b19f61d94413189c73b6ed6bd4b92311a44ed01f67bb0",
|
|
||||||
name: "Valerium"
|
|
||||||
},
|
|
||||||
"1411089581058822275": {
|
|
||||||
key: "c37c74a774458d3c54bdd8fa36ffa193dac974c33cafea836cbac826706fa102",
|
|
||||||
name: "Sakura"
|
|
||||||
},
|
|
||||||
"1433657054433771621": {
|
"1433657054433771621": {
|
||||||
key: "e650f6e74a6e284d8fa3417325e0bf77783a51875075e0fd8aae1b44bb733097",
|
key: "e650f6e74a6e284d8fa3417325e0bf77783a51875075e0fd8aae1b44bb733097",
|
||||||
name: "Nomena"
|
name: "Nomena",
|
||||||
},
|
},
|
||||||
"1436837822656020663": {
|
"1436837822656020663": {
|
||||||
key: "6ef16fb0676f8021094bbc86ce138288da6461c642be0cd7521dca22fcff07ae",
|
key: "6ef16fb0676f8021094bbc86ce138288da6461c642be0cd7521dca22fcff07ae",
|
||||||
name: "Tyche"
|
name: "Tyche",
|
||||||
},
|
},
|
||||||
"1438325099345346723": {
|
"1438325099345346723": {
|
||||||
key: "e43595045feb40714c898d4cc4be600581ce155e39dc36155e6f3e4602b55b25",
|
key: "e43595045feb40714c898d4cc4be600581ce155e39dc36155e6f3e4602b55b25",
|
||||||
name: "Saisoku"
|
name: "Saisoku",
|
||||||
}
|
},
|
||||||
|
"1459002793179349023": {
|
||||||
|
key: "90ab6b4be1f73708ef46b4f72141dde0254f68124f9642fabedbbfc4618d07cc",
|
||||||
|
name: "Tesseract",
|
||||||
|
},
|
||||||
|
"1459007370746134691": {
|
||||||
|
key: "8082f0f536a0bea6cdd28fab2f6e8451f927858901025b5b5d77fa39b3aaf6c3",
|
||||||
|
name: "Ephemere",
|
||||||
|
},
|
||||||
|
"884082547183747153": {
|
||||||
|
key: "5a73fdbd5fc5b56dbc8b19f61d94413189c73b6ed6bd4b92311a44ed01f67bb0",
|
||||||
|
name: "Valerium",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
+26
-4
@@ -92,6 +92,31 @@ interface DiscordErrorPayloadOptions {
|
|||||||
stack: string;
|
stack: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Media Container with error header image.
|
||||||
|
* @param appName - The name of the application.
|
||||||
|
* @returns The Media Container component.
|
||||||
|
*/
|
||||||
|
const createMediaContainer = (appName: string): Record<string, unknown> => {
|
||||||
|
return {
|
||||||
|
accessory: {
|
||||||
|
description: null,
|
||||||
|
media: {
|
||||||
|
url: "https://cdn.nhcarrigan.com/error.jpeg",
|
||||||
|
},
|
||||||
|
spoiler: false,
|
||||||
|
type: 11,
|
||||||
|
},
|
||||||
|
components: [
|
||||||
|
{
|
||||||
|
content: `# Error in ${appName}`,
|
||||||
|
type: 10,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
type: 9,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Discord ComponentsV2 payload with a container layout
|
* Creates a Discord ComponentsV2 payload with a container layout
|
||||||
* for beautiful error notifications.
|
* for beautiful error notifications.
|
||||||
@@ -108,10 +133,7 @@ const createDiscordErrorPayload = (
|
|||||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Discord API property.
|
// eslint-disable-next-line @typescript-eslint/naming-convention -- Discord API property.
|
||||||
accent_color: 15_277_667,
|
accent_color: 15_277_667,
|
||||||
components: [
|
components: [
|
||||||
{
|
createMediaContainer(appName),
|
||||||
content: `# Error in ${appName}`,
|
|
||||||
type: 10,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
divider: true,
|
divider: true,
|
||||||
spacing: 1,
|
spacing: 1,
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ export const sendMail = async(subject: string, body: string): Promise<void> => {
|
|||||||
user: "noreply@nhcarrigan.com",
|
user: "noreply@nhcarrigan.com",
|
||||||
},
|
},
|
||||||
host: "mail.nhcarrigan.com",
|
host: "mail.nhcarrigan.com",
|
||||||
port: 587, // UPDATED: Standard port for STARTTLS
|
// UPDATED: Standard port for STARTTLS
|
||||||
secure: false, // UPDATED: false means "Connect then upgrade via STARTTLS"
|
port: 587,
|
||||||
|
// UPDATED: false means "Connect then upgrade via STARTTLS"
|
||||||
|
secure: false,
|
||||||
};
|
};
|
||||||
const defaults: SMTPTransport["options"] = {
|
const defaults: SMTPTransport["options"] = {
|
||||||
from: "noreply@nhcarrigan.com",
|
from: "noreply@nhcarrigan.com",
|
||||||
@@ -33,4 +35,4 @@ export const sendMail = async(subject: string, body: string): Promise<void> => {
|
|||||||
subject: subject,
|
subject: subject,
|
||||||
text: body,
|
text: body,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user