Skip to content

Commit

Permalink
discord message fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vrtnd committed Jul 26, 2024
1 parent 9def4c7 commit 18175bd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ import fetch from "node-fetch";

export async function sendDiscordText(message: string): Promise<void> {
try {
await fetch(process.env.DISCORD_WEBHOOK as string, {
const res = await fetch(process.env.DISCORD_WEBHOOK as string, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ content: message }),
});
if (!res.ok) {
console.error("Failed to send message to Discord:", res.statusText);
}
if (res.ok) {
console.log("Message sent to Discord:", message);
}
} catch (error) {
console.error("Failed to send message to Discord:", error);
}
Expand Down

0 comments on commit 18175bd

Please sign in to comment.