mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge pull request #793 from 190km/discord-notifications
style: improved discord webhooks notifications style
This commit is contained in:
@@ -188,8 +188,9 @@ export const notificationRouter = createTRPCRouter({
|
|||||||
.mutation(async ({ input }) => {
|
.mutation(async ({ input }) => {
|
||||||
try {
|
try {
|
||||||
await sendDiscordNotification(input, {
|
await sendDiscordNotification(input, {
|
||||||
title: "Test Notification",
|
title: "> `🤚` - Test Notification",
|
||||||
description: "Hi, From Dokploy 👋",
|
description: "> Hi, From Dokploy 👋",
|
||||||
|
color: 0xf3f7f4
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -59,31 +59,46 @@ export const sendBuildErrorNotifications = async ({
|
|||||||
|
|
||||||
if (discord) {
|
if (discord) {
|
||||||
await sendDiscordNotification(discord, {
|
await sendDiscordNotification(discord, {
|
||||||
title: "⚠️ Build Failed",
|
title: "> `⚠️` - Build Failed",
|
||||||
color: 0xff0000,
|
color: 0xed4245,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "Project",
|
name: "`🛠️`・Project",
|
||||||
value: projectName,
|
value: projectName,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Application",
|
name: "`⚙️`・Application",
|
||||||
value: applicationName,
|
value: applicationName,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Type",
|
name: "`❔`・Type",
|
||||||
value: applicationType,
|
value: applicationType,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Error",
|
name: "`📅`・Date",
|
||||||
value: errorMessage,
|
value: date.toLocaleDateString(),
|
||||||
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Build Link",
|
name: "`⌚`・Time",
|
||||||
value: buildLink,
|
value: date.toLocaleTimeString(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`❓`・Type",
|
||||||
|
value: "Failed",
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`⚠️`・Error Message",
|
||||||
|
value: `\`\`\`${errorMessage}\`\`\``,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`🧷`・Build Link",
|
||||||
|
value: `[Click here to access build link](${buildLink})`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
timestamp: date.toISOString(),
|
timestamp: date.toISOString(),
|
||||||
|
|||||||
@@ -57,27 +57,42 @@ export const sendBuildSuccessNotifications = async ({
|
|||||||
|
|
||||||
if (discord) {
|
if (discord) {
|
||||||
await sendDiscordNotification(discord, {
|
await sendDiscordNotification(discord, {
|
||||||
title: "✅ Build Success",
|
title: "> `✅` - Build Success",
|
||||||
color: 0x00ff00,
|
color: 0x57f287,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "Project",
|
name: "`🛠️`・Project",
|
||||||
value: projectName,
|
value: projectName,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Application",
|
name: "`⚙️`・Application",
|
||||||
value: applicationName,
|
value: applicationName,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Type",
|
name: "`❔`・Application Type",
|
||||||
value: applicationType,
|
value: applicationType,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Build Link",
|
name: "`📅`・Date",
|
||||||
value: buildLink,
|
value: date.toLocaleDateString(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`⌚`・Time",
|
||||||
|
value: date.toLocaleTimeString(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`❓`・Type",
|
||||||
|
value: "Successful",
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`🧷`・Build Link",
|
||||||
|
value: `[Click here to access build link](${buildLink})`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
timestamp: date.toISOString(),
|
timestamp: date.toISOString(),
|
||||||
|
|||||||
@@ -64,39 +64,45 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
await sendDiscordNotification(discord, {
|
await sendDiscordNotification(discord, {
|
||||||
title:
|
title:
|
||||||
type === "success"
|
type === "success"
|
||||||
? "✅ Database Backup Successful"
|
? "> `✅` - Database Backup Successful"
|
||||||
: "❌ Database Backup Failed",
|
: "> `❌` - Database Backup Failed",
|
||||||
color: type === "success" ? 0x00ff00 : 0xff0000,
|
color: type === "success" ? 0x57f287 : 0xed4245,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "Project",
|
name: "`🛠️`・Project",
|
||||||
value: projectName,
|
value: projectName,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Application",
|
name: "`⚙️`・Application",
|
||||||
value: applicationName,
|
value: applicationName,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Type",
|
name: "`❔`・Database",
|
||||||
value: databaseType,
|
value: databaseType,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Time",
|
name: "`📅`・Date",
|
||||||
value: date.toLocaleString(),
|
value: date.toLocaleDateString(),
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Type",
|
name: "`⌚`・Time",
|
||||||
value: type,
|
value: date.toLocaleTimeString(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`❓`・Type",
|
||||||
|
value: type.replace("error", "Failed").replace("success", "Successful"),
|
||||||
|
inline: true,
|
||||||
},
|
},
|
||||||
...(type === "error" && errorMessage
|
...(type === "error" && errorMessage
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
name: "Error Message",
|
name: "`⚠️`・Error Message",
|
||||||
value: errorMessage,
|
value: `\`\`\`${errorMessage}\`\`\``,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
|||||||
@@ -45,12 +45,28 @@ export const sendDockerCleanupNotifications = async (
|
|||||||
|
|
||||||
if (discord) {
|
if (discord) {
|
||||||
await sendDiscordNotification(discord, {
|
await sendDiscordNotification(discord, {
|
||||||
title: "✅ Docker Cleanup",
|
title: "> `✅` - Docker Cleanup",
|
||||||
color: 0x00ff00,
|
color: 0x57f287,
|
||||||
fields: [
|
fields: [
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "Message",
|
name: "`📅`・Date",
|
||||||
value: message,
|
value: date.toLocaleDateString(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`⌚`・Time",
|
||||||
|
value: date.toLocaleTimeString(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`❓`・Type",
|
||||||
|
value: "Successful",
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`📜`・Message",
|
||||||
|
value: `\`\`\`${message}\`\`\``,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
timestamp: date.toISOString(),
|
timestamp: date.toISOString(),
|
||||||
|
|||||||
@@ -34,12 +34,22 @@ export const sendDokployRestartNotifications = async () => {
|
|||||||
|
|
||||||
if (discord) {
|
if (discord) {
|
||||||
await sendDiscordNotification(discord, {
|
await sendDiscordNotification(discord, {
|
||||||
title: "✅ Dokploy Server Restarted",
|
title: "> `✅` - Dokploy Server Restarted",
|
||||||
color: 0x00ff00,
|
color: 0x57f287,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "Time",
|
name: "`📅`・Date",
|
||||||
value: date.toLocaleString(),
|
value: date.toLocaleDateString(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`⌚`・Time",
|
||||||
|
value: date.toLocaleTimeString(),
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "`❓`・Type",
|
||||||
|
value: "Successful",
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user