Update telegram.ts

This commit is contained in:
Xtao_dada 2021-12-27 02:10:09 +08:00 committed by GitHub
parent 039181afe4
commit 044fc276af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
import fetch from 'node-fetch'
export async function sendToTelegram(text: string) {
const URL = `https://api.telegram.org/bot${process.env.TELEGRAM_TOKEN}/sendMessage`
const body = `chat_id=${process.env.TELEGRAM_CHAT_ID}&text=${text}`
@ -13,4 +14,4 @@ export async function sendToTelegram(text: string) {
if (!data.ok) {
console.error(data.StatusMessage)
}
}
}