fix(auth): add pexsecBot for Telegram login on app.pezkuwichain.io

- pex.mom uses @PexMomBOT (8690398980)
- app.pezkuwichain.io uses @pexsecBot (8754021997)
- Edge function selects token based on bot_id from request
This commit is contained in:
2026-05-01 23:32:25 +03:00
parent ef6a7b2583
commit 9babb94e07
2 changed files with 8 additions and 6 deletions
@@ -42,11 +42,13 @@ Deno.serve(async (req) => {
}
try {
const botToken = Deno.env.get('TELEGRAM_BOT_TOKEN_PEZMOM')
if (!botToken) throw new Error('TELEGRAM_BOT_TOKEN_PEZMOM not configured')
const body = await req.json()
const { id, first_name, last_name, username, photo_url, auth_date, hash } = body
const { id, first_name, last_name, username, photo_url, auth_date, hash, bot_id } = body
const botToken = bot_id === '8690398980'
? Deno.env.get('TELEGRAM_BOT_TOKEN_PEZMOM')
: Deno.env.get('TELEGRAM_BOT_TOKEN_PEXSEC')
if (!botToken) throw new Error('Bot token not configured for bot_id: ' + bot_id)
if (!id || !hash || !auth_date) {
return new Response(JSON.stringify({ error: 'Missing required fields' }), {