Initial commit - cleaned for CV

This commit is contained in:
Renato97
2026-03-31 01:23:33 -03:00
commit 9c11f23af0
142 changed files with 13690 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
import { NextResponse } from 'next/server'
export async function POST(request: Request) {
try {
const { botToken, chatId } = await request.json()
if (!botToken || !chatId) {
return NextResponse.json(
{ success: false, error: 'Faltan credenciales (Token o Chat ID)' },
{ status: 400 }
)
}
const message = "🤖 *Prueba de Conexión*\n\n¡Hola! Si lees esto, tu bot de Finanzas está correctamente configurado. 🚀"
const url = `https://api.telegram.org/bot${botToken}/sendMessage`
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
chat_id: chatId,
text: message,
parse_mode: 'Markdown'
})
})
const data = await response.json()
if (!data.ok) {
return NextResponse.json(
{ success: false, error: data.description || 'Error desconocido de Telegram' },
{ status: 500 }
)
}
return NextResponse.json({ success: true, data })
} catch (error: any) {
console.error('Telegram Test Error:', error)
return NextResponse.json(
{ success: false, error: error.message || 'Error interno del servidor' },
{ status: 500 }
)
}
}