feat: implement decoration to embeds

This commit is contained in:
João Gabriel
2024-12-22 00:44:25 -03:00
parent 055b59e6fa
commit 870e074825
7 changed files with 64 additions and 45 deletions

View File

@@ -363,7 +363,7 @@ export const authRouter = createTRPCRouter({
<a href="${WEBSITE_URL}/reset-password?token=${token}">
Reset Password
</a>
`,
);
}),
@@ -505,7 +505,7 @@ export const sendDiscordNotificationWelcome = async (newAdmin: Auth) => {
webhookUrl: process.env.DISCORD_WEBHOOK_URL || "",
},
{
title: " New User Registered",
title: "New User Registered",
color: 0x00ff00,
fields: [
{

View File

@@ -187,11 +187,15 @@ export const notificationRouter = createTRPCRouter({
.input(apiTestDiscordConnection)
.mutation(async ({ input }) => {
try {
const decorate = (decoration: string, text: string) =>
`${input.decoration ? decoration : ""} ${text}`.trim();
await sendDiscordNotification(input, {
title: "> `🤚` - Test Notification",
description: "> Hi, From Dokploy 👋",
title: decorate(">", "`🤚` - Test Notification"),
description: decorate(">", "Hi, From Dokploy 👋"),
color: 0xf3f7f4,
});
return true;
} catch (error) {
throw new TRPCError({