mirror of
https://github.com/ArthurDanjou/website.git
synced 2026-01-14 12:14:42 +01:00
29 lines
735 B
TypeScript
29 lines
735 B
TypeScript
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'
|
|
}
|
|
})
|
|
}
|