mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge pull request #864 from mezotv/dynamic-timestamp
feat(dynamic timestamp): add dynamic discord timestamps
This commit is contained in:
@@ -28,6 +28,7 @@ export const sendBuildErrorNotifications = async ({
|
|||||||
adminId,
|
adminId,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
const unixDate = ~~((Number(date)) / 1000);
|
||||||
const notificationList = await db.query.notifications.findMany({
|
const notificationList = await db.query.notifications.findMany({
|
||||||
where: and(
|
where: and(
|
||||||
eq(notifications.appBuildError, true),
|
eq(notifications.appBuildError, true),
|
||||||
@@ -79,12 +80,12 @@ export const sendBuildErrorNotifications = async ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "`📅`・Date",
|
name: "`📅`・Date",
|
||||||
value: date.toLocaleDateString(),
|
value: `<t:${unixDate}:D>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "`⌚`・Time",
|
name: "`⌚`・Time",
|
||||||
value: date.toLocaleTimeString(),
|
value: `<t:${unixDate}:t>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export const sendBuildSuccessNotifications = async ({
|
|||||||
adminId,
|
adminId,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
const unixDate = ~~((Number(date)) / 1000);
|
||||||
const notificationList = await db.query.notifications.findMany({
|
const notificationList = await db.query.notifications.findMany({
|
||||||
where: and(
|
where: and(
|
||||||
eq(notifications.appDeploy, true),
|
eq(notifications.appDeploy, true),
|
||||||
@@ -77,12 +78,12 @@ export const sendBuildSuccessNotifications = async ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "`📅`・Date",
|
name: "`📅`・Date",
|
||||||
value: date.toLocaleDateString(),
|
value: `<t:${unixDate}:D>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "`⌚`・Time",
|
name: "`⌚`・Time",
|
||||||
value: date.toLocaleTimeString(),
|
value: `<t:${unixDate}:t>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
errorMessage?: string;
|
errorMessage?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
const unixDate = ~~((Number(date)) / 1000);
|
||||||
const notificationList = await db.query.notifications.findMany({
|
const notificationList = await db.query.notifications.findMany({
|
||||||
where: and(
|
where: and(
|
||||||
eq(notifications.databaseBackup, true),
|
eq(notifications.databaseBackup, true),
|
||||||
@@ -85,12 +86,12 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "`📅`・Date",
|
name: "`📅`・Date",
|
||||||
value: date.toLocaleDateString(),
|
value: `<t:${unixDate}:D>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "`⌚`・Time",
|
name: "`⌚`・Time",
|
||||||
value: date.toLocaleTimeString(),
|
value: `<t:${unixDate}:t>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export const sendDockerCleanupNotifications = async (
|
|||||||
message = "Docker cleanup for dokploy",
|
message = "Docker cleanup for dokploy",
|
||||||
) => {
|
) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
const unixDate = ~~((Number(date)) / 1000);
|
||||||
const notificationList = await db.query.notifications.findMany({
|
const notificationList = await db.query.notifications.findMany({
|
||||||
where: and(
|
where: and(
|
||||||
eq(notifications.dockerCleanup, true),
|
eq(notifications.dockerCleanup, true),
|
||||||
@@ -50,12 +51,12 @@ export const sendDockerCleanupNotifications = async (
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "`📅`・Date",
|
name: "`📅`・Date",
|
||||||
value: date.toLocaleDateString(),
|
value: `<t:${unixDate}:D>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "`⌚`・Time",
|
name: "`⌚`・Time",
|
||||||
value: date.toLocaleTimeString(),
|
value: `<t:${unixDate}:t>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
|
|
||||||
export const sendDokployRestartNotifications = async () => {
|
export const sendDokployRestartNotifications = async () => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
const unixDate = ~~((Number(date)) / 1000);
|
||||||
const notificationList = await db.query.notifications.findMany({
|
const notificationList = await db.query.notifications.findMany({
|
||||||
where: eq(notifications.dokployRestart, true),
|
where: eq(notifications.dokployRestart, true),
|
||||||
with: {
|
with: {
|
||||||
@@ -39,12 +40,12 @@ export const sendDokployRestartNotifications = async () => {
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "`📅`・Date",
|
name: "`📅`・Date",
|
||||||
value: date.toLocaleDateString(),
|
value: `<t:${unixDate}:D>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "`⌚`・Time",
|
name: "`⌚`・Time",
|
||||||
value: date.toLocaleTimeString(),
|
value: `<t:${unixDate}:t>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user