mirror of
https://github.com/ArthurDanjou/website.git
synced 2026-01-28 19:00:31 +01:00
Import drizzle replacing prisma
Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
28
server/utils/discord.ts
Normal file
28
server/utils/discord.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { RuntimeConfig } from 'nuxt/schema'
|
||||
|
||||
interface WebhookContent {
|
||||
title: string
|
||||
description: string
|
||||
color: number
|
||||
}
|
||||
|
||||
export async function sendDiscordWebhookMessage(config: RuntimeConfig, content: WebhookContent) {
|
||||
await $fetch(`https://discordapp.com/api/webhooks/${config.discordId}/${config.discordToken}`, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
embeds: [
|
||||
{
|
||||
title: content.title,
|
||||
description: content.description,
|
||||
color: content.color,
|
||||
url: 'https://arthurdanjou.fr/talents',
|
||||
footer: {
|
||||
text: 'Powered by Nuxt'
|
||||
},
|
||||
timestamp: new Date().toISOString()
|
||||
}
|
||||
],
|
||||
username: 'ArtDanjRobot - Website'
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user