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

@@ -157,15 +157,23 @@ export class QuixoticBot {
// Handle web app data
this.bot.on('web_app_data', async (msg: Message) => {
console.log('🔍 Web app data received:', msg.web_app?.data);
const chatId = msg.chat.id;
if (!msg.web_app?.data) return;
if (!msg.web_app?.data) {
console.log('❌ No web app data found');
return;
}
const data: WebAppData = JSON.parse(msg.web_app.data);
console.log('📝 Parsed data:', data);
try {
if (data.action === 'send_audio') {
console.log('🎵 Sending audio file:', data.title);
await this.sendAudioFile(chatId, data.audioUrl, data.title);
} else {
console.log('⚠️ Unknown action:', data.action);
}
} catch (error) {
console.error('Web app data error:', error);