feat: mail telegram and cron check
This commit is contained in:
1 parent
6e1d0a7568
commit
8b33242db1
6 files changed
+180
No files matched your search
@@ -0,0 +1,10 @@
|
||||
export async function sendTelegram(chatId: string, text: string): Promise<void> {
|
||||
const token = process.env.TELEGRAM_BOT_TOKEN;
|
||||
if (!token) throw new Error("TELEGRAM_BOT_TOKEN fehlt");
|
||||
const res = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ chat_id: chatId, text }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`Telegram ${res.status}`);
|
||||
}
|
||||
Reference in new issue
Block a user