export async function sendDiscordNotification(content: string, embed?: any) { const token = process.env.DISCORD_BOT_TOKEN; const channelId = process.env.DISCORD_CHANNEL_ID; if (!token) { console.error("[Discord Notification] Missing DISCORD_BOT_TOKEN"); return; } if (!channelId) { console.error("[Discord Notification] Missing DISCORD_CHANNEL_ID environment variable. Please add it to your .env file."); return; } try { const res = await fetch(`https://discord.com/api/v10/channels/${channelId}/messages`, { method: "POST", headers: { "Authorization": `Bot ${token}`, "Content-Type": "application/json" }, body: JSON.stringify({ content, embeds: embed ? [embed] : undefined }) }); if (!res.ok) { console.error("[Discord Notification] Failed to send message:", await res.text()); } else { } } catch (error) { console.error("[Discord Notification] Error sending message:", error); } }