Merge pull request #864 from mezotv/dynamic-timestamp

feat(dynamic timestamp): add dynamic discord timestamps
This commit is contained in:
Mauricio Siu
2024-12-11 23:28:47 -06:00
committed by GitHub
5 changed files with 15 additions and 10 deletions

View File

@@ -28,6 +28,7 @@ export const sendBuildErrorNotifications = async ({
adminId,
}: Props) => {
const date = new Date();
const unixDate = ~~((Number(date)) / 1000);
const notificationList = await db.query.notifications.findMany({
where: and(
eq(notifications.appBuildError, true),
@@ -79,12 +80,12 @@ export const sendBuildErrorNotifications = async ({
},
{
name: "`📅`・Date",
value: date.toLocaleDateString(),
value: `<t:${unixDate}:D>`,
inline: true,
},
{
name: "`⌚`・Time",
value: date.toLocaleTimeString(),
value: `<t:${unixDate}:t>`,
inline: true,
},
{

View File

@@ -26,6 +26,7 @@ export const sendBuildSuccessNotifications = async ({
adminId,
}: Props) => {
const date = new Date();
const unixDate = ~~((Number(date)) / 1000);
const notificationList = await db.query.notifications.findMany({
where: and(
eq(notifications.appDeploy, true),
@@ -77,12 +78,12 @@ export const sendBuildSuccessNotifications = async ({
},
{
name: "`📅`・Date",
value: date.toLocaleDateString(),
value: `<t:${unixDate}:D>`,
inline: true,
},
{
name: "`⌚`・Time",
value: date.toLocaleTimeString(),
value: `<t:${unixDate}:t>`,
inline: true,
},
{

View File

@@ -26,6 +26,7 @@ export const sendDatabaseBackupNotifications = async ({
errorMessage?: string;
}) => {
const date = new Date();
const unixDate = ~~((Number(date)) / 1000);
const notificationList = await db.query.notifications.findMany({
where: and(
eq(notifications.databaseBackup, true),
@@ -85,12 +86,12 @@ export const sendDatabaseBackupNotifications = async ({
},
{
name: "`📅`・Date",
value: date.toLocaleDateString(),
value: `<t:${unixDate}:D>`,
inline: true,
},
{
name: "`⌚`・Time",
value: date.toLocaleTimeString(),
value: `<t:${unixDate}:t>`,
inline: true,
},
{

View File

@@ -15,6 +15,7 @@ export const sendDockerCleanupNotifications = async (
message = "Docker cleanup for dokploy",
) => {
const date = new Date();
const unixDate = ~~((Number(date)) / 1000);
const notificationList = await db.query.notifications.findMany({
where: and(
eq(notifications.dockerCleanup, true),
@@ -50,12 +51,12 @@ export const sendDockerCleanupNotifications = async (
fields: [
{
name: "`📅`・Date",
value: date.toLocaleDateString(),
value: `<t:${unixDate}:D>`,
inline: true,
},
{
name: "`⌚`・Time",
value: date.toLocaleTimeString(),
value: `<t:${unixDate}:t>`,
inline: true,
},
{

View File

@@ -12,6 +12,7 @@ import {
export const sendDokployRestartNotifications = async () => {
const date = new Date();
const unixDate = ~~((Number(date)) / 1000);
const notificationList = await db.query.notifications.findMany({
where: eq(notifications.dokployRestart, true),
with: {
@@ -39,12 +40,12 @@ export const sendDokployRestartNotifications = async () => {
fields: [
{
name: "`📅`・Date",
value: date.toLocaleDateString(),
value: `<t:${unixDate}:D>`,
inline: true,
},
{
name: "`⌚`・Time",
value: date.toLocaleTimeString(),
value: `<t:${unixDate}:t>`,
inline: true,
},
{