Update txc.ts

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

View File

@ -34,7 +34,7 @@ function handleMessage(name: string, data: any): string {
return `${name}${action}: ${content}`
}
function main(req: VercelRequest, res: VercelResponse) {
async function main(req: VercelRequest, res: VercelResponse) {
if (req.method !== 'POST') {
res.setHeader('Allow', 'POST')
return res.status(405).end('Method Not Allowed')
@ -44,10 +44,10 @@ function main(req: VercelRequest, res: VercelResponse) {
const product = req.query.product.toString() || 'Unknown'
const content = handleMessage(product, req.body)
if (bots.indexOf('TELEGRAM') >= 0) {
sendToTelegram(content)
await sendToTelegram(content)
}
if (bots.indexOf('FEISHU') >= 0) {
sendToFeishu(content)
await sendToFeishu(content)
}
return res.status(200).end('ok')
} catch (e) {