const { listDataFiles, buildPage } = require('../commands/backuplogs'); module.exports = { prefix: 'bkpage:', handler: async (bot, query) => { const chatId = query.message.chat.id; const botMessageId = query.message.message_id; const parts = query.data.split(':'); const page = parseInt(parts[1]); const userMessageId = parts[2]; const files = await listDataFiles(); const keyboard = buildPage(files, page, userMessageId); const text = `*Backup & Logs*\n\n${files.length} file disponibili nella cartella data.\n_Seleziona un file per info e download._`; try { await bot.editMessageText(text, { chat_id: chatId, message_id: botMessageId, parse_mode: 'Markdown', reply_markup: { inline_keyboard: keyboard } }); } catch (e) {} bot.answerCallbackQuery(query.id); } };