yt-dlp headless capture (15dk segmentleme), ses peak + chat velocity sinyal tespiti, OpenAI Whisper STT (kelime zaman damgalı), BullMQ/Redis/Postgres altyapısı ve kanal durumu + transkript kütüphanesi gösteren Next.js panel. LLM virality skorlama, render/crop/altyazı ve multi-platform dağıtım bu fazın kapsamı dışında. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
21 lines
708 B
TypeScript
21 lines
708 B
TypeScript
const BOT_TOKEN = process.env.TELEGRAM_BOT_TOKEN ?? "";
|
|
const CHAT_ID = process.env.TELEGRAM_CHAT_ID ?? "";
|
|
|
|
export async function sendTelegramMessage(text: string): Promise<void> {
|
|
if (!BOT_TOKEN || !CHAT_ID) {
|
|
console.warn("[telegram] TELEGRAM_BOT_TOKEN/TELEGRAM_CHAT_ID not set, skipping notification:", text);
|
|
return;
|
|
}
|
|
|
|
const url = `https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`;
|
|
const res = await fetch(url, {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ chat_id: CHAT_ID, text, parse_mode: "Markdown" }),
|
|
});
|
|
|
|
if (!res.ok) {
|
|
console.error("[telegram] failed to send message:", res.status, await res.text());
|
|
}
|
|
}
|