tangled
alpha
login
or
join now
timtinkers.online
/
discord-qotd-webhook
1
fork
atom
posts "question of the day" to a discord webhook
1
fork
atom
overview
issues
pulls
pipelines
Embed customization
timtinkers.online
7 months ago
5a80133b
e13bace3
+15
-5
1 changed file
expand all
collapse all
unified
split
utils
discordUtils.ts
+15
-5
utils/discordUtils.ts
reviewed
···
3
3
await load({ export: true });
4
4
5
5
export async function sendDiscordNotification(quote: string) {
6
6
-
const embed = {
7
7
-
title: "❓❔ Question of the Day ❓❔",
6
6
+
const embed1 = {
7
7
+
color: 0xFEF250, // lemon yellow
8
8
+
image: { url: Deno.env.get("IMAGE_URL") },
9
9
+
};
10
10
+
11
11
+
const embed2 = {
12
12
+
title: `· · ─ ·𝒒𝒖𝒆𝒔𝒕𝒊𝒐𝒏 𝒐𝒇 𝒕𝒉𝒆 𝒅𝒂𝒚 · ─ · ·`,
8
13
color: 0xFEF250, // lemon yellow
9
14
description: quote,
10
10
-
//timestamp: new Date().toISOString(),
15
15
+
thumbnail: { url: Deno.env.get("THUMBNAIL_URL") },
16
16
+
footer: { text: `𐔌՞. .՞𐦯` },
11
17
};
12
18
13
13
-
await fetch(Deno.env.get("DISCORD_WEBHOOK_URL")!, {
19
19
+
const response = await fetch(Deno.env.get("DISCORD_WEBHOOK_URL")!, {
14
20
method: "POST",
15
21
headers: {
16
22
"Content-Type": "application/json",
17
23
},
18
24
body: JSON.stringify({
19
19
-
embeds: [embed],
25
25
+
embeds: [embed1, embed2],
20
26
}),
21
27
});
28
28
+
29
29
+
if (!response.ok) {
30
30
+
throw new Error(`Discord webhook failed: ${response.status}`);
31
31
+
}
22
32
}