feat: add tiktok polling system with docker cron

This commit is contained in:
2026-07-03 21:18:12 +07:00 Unverified
parent 80dcaf1bc2
commit 96b7ce11c0
6 changed files with 156 additions and 161 deletions
+35
View File
@@ -0,0 +1,35 @@
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);
}
}