Aggiunto collegamento al server

This commit is contained in:
Giuseppe Raffa
2026-03-11 15:25:03 +01:00
parent c37f30e4ea
commit 41f33ce181
51 changed files with 3088 additions and 4414 deletions

View File

@@ -0,0 +1,51 @@
const realtime = require('../../realtime/core.js');
const { config } = require('../../config.js');
module.exports = [
{
id: 'logs-refresh',
execute: async ({ bot, chatId, msg }) => {
const stats = realtime.getStats();
const consoleUrl = config.cloudUrl || 'https://console.mebboat.it';
let statusIcon = '🔴';
if (stats.status === 'connected') statusIcon = '🟢';
else if (stats.status === 'error') statusIcon = '🟡';
const now = new Date().toLocaleTimeString('it-IT');
let text = `📊 *Registrazione Dati Realtime*\n\n`;
text += `Stato: ${statusIcon} *${stats.status}*\n`;
text += `Sensore: \`${stats.sensorID}\`\n`;
text += `Messaggi inviati: *${stats.sent}*\n`;
text += `Frequenza: ogni *${stats.sentEveryMLS / 1000}s*\n`;
if (stats.buffered > 0) {
text += `⚠️ Messaggi in buffer: *${stats.buffered}*\n`;
}
if (stats.reconnections > 0) {
text += `Riconnessioni: ${stats.reconnections}\n`;
}
text += `\n_(Aggiornato: ${now})_`;
try {
await bot.editMessageText(text, {
chat_id: chatId,
message_id: msg.message_id,
parse_mode: 'Markdown',
reply_markup: {
inline_keyboard: [
[{ text: '📈 Apri Console Log', url: `${consoleUrl}/logs` }],
[{ text: '🔄 Aggiorna Stato', callback_data: 'logs-refresh' }]
]
}
});
} catch (e) {
if (!e.message.includes('message is not modified')) {
console.error("[Telegram] Errore refresh logs:", e);
}
}
}
}
];