34 lines
1.2 KiB
Markdown
34 lines
1.2 KiB
Markdown
# 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 |