This commit is contained in:
Andrey Kondratev
2025-08-29 14:37:07 +05:00
parent 4dacc1aeb8
commit 816b0ec672
3 changed files with 47 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
# Song Selection Issue Analysis
## Problem
- Production: Song selection says it will send to chat but doesn't actually send
- /start command works fine
- No errors in logs
## Code Flow Analysis
### Working /start Command (src/bot.ts:66-95)
1. User sends /start command
2. Bot receives via `this.bot.onText(/\/start/)`
3. Direct bot.sendMessage() call works
### Broken Song Selection Flow
1. User selects song in Web App (public/script.ts:248)
2. Web App calls `this.tg.sendData()` with JSON payload
3. Should trigger `web_app_data` event in bot (src/bot.ts:159)
4. Bot should call `sendAudioFile()` method (src/bot.ts:224)
## Key Differences
- /start: Direct Telegram command → immediate bot response
- Song selection: Web App → sendData() → web_app_data event → bot response
## Potential Issues
1. `this.tg.sendData()` might not be working in production environment
2. `web_app_data` event handler might not be triggered
3. Web App URL environment variable mismatch
4. Telegram Web App integration issues in production
## Next Steps
- Check production environment variables (WEB_APP_URL, TELEGRAM_BOT_TOKEN)
- Add logging to web_app_data handler
- Verify Telegram Web App configuration