Comandos Bot
Sincronizar EPG
Verificar Canales
Reparar Lista
Estado del Sistema
Descargar Lista
Introduce la URL de la lista M3U:
Enviar URL
脷ltima Actividad
Configuraci贸n del Sistema
Configuraci贸n
Username del Bot:
C贸digo Admin:
Contrase帽a:
Guardar Cambios
Volver
Tip:
El bot requiere que todos los campos est茅n configurados para procesar tus comandos por seguridad.
Los datos se guardan de forma privada en este navegador.
// Inicializaci贸n y Carga function init() { document.getElementById('bot-username').value = localStorage.getItem('bot_username') || ''; document.getElementById('admin-code').value = localStorage.getItem('admin_code') || ''; document.getElementById('password').value = localStorage.getItem('password') || ''; updateStatusDot(); loadHistory(); } function updateStatusDot() { const p = getParams(); const dot = document.getElementById('config-status'); if (p.user && p.code && p.pass) { dot.className = 'status-dot status-ok'; } else { dot.className = 'status-dot status-off'; } } function toggleVisibility(id) { const el = document.getElementById(id); el.type = el.type === 'password' ? 'text' : 'password'; } function saveConfig() { const user = document.getElementById('bot-username').value.trim().replace('@', ''); const code = document.getElementById('admin-code').value.trim(); const pass = document.getElementById('password').value.trim(); if (!user || !code || !pass) { alert('Todos los campos son obligatorios para el funcionamiento del bot.'); return; } localStorage.setItem('bot_username', user); localStorage.setItem('admin_code', code); localStorage.setItem('password', pass); updateStatusDot(); alert('Configuraci贸n actualizada'); toggleConfig(); } function toggleConfig() { const main = document.getElementById('main-ui'); const config = document.getElementById('config-ui'); if (main.classList.contains('hidden')) { main.classList.remove('hidden'); config.classList.add('hidden'); } else { main.classList.add('hidden'); config.classList.remove('hidden'); } } function getParams() { return { user: localStorage.getItem('bot_username'), code: localStorage.getItem('admin_code'), pass: localStorage.getItem('password') }; } function checkConfig(params) { if (!params.user || !params.code || !params.pass) { alert('Configuraci贸n incompleta. Por favor, rellena todos los campos en el panel de configuraci贸n.'); if (document.getElementById('main-ui').classList.contains('hidden') === false) { toggleConfig(); } return false; } return true; } function addToHistory(cmd) { const history = JSON.parse(localStorage.getItem('cmd_history') || '[]'); const now = new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); history.unshift({ cmd, time: now }); if (history.length > 5) history.pop(); localStorage.setItem('cmd_history', JSON.stringify(history)); loadHistory(); } function loadHistory() { const history = JSON.parse(localStorage.getItem('cmd_history') || '[]'); const container = document.getElementById('history-card'); const list = document.getElementById('history-list'); if (history.length === 0) { container.classList.add('hidden'); return; } container.classList.remove('hidden'); list.innerHTML = history.map(item => `\n
\n
${item.cmd}
\n
${item.time}
\n
\n `).join(''); } function sendCmd(cmd) { const p = getParams(); if (!checkConfig(p)) return; const msg = p.code + " " + cmd + " " + p.pass; addToHistory(cmd); openTelegram(p.user, msg); } function sendDownload() { const urlInput = document.getElementById('download-url'); const urlValue = urlInput.value.trim(); if (!urlValue) { alert('Introduce una URL v谩lida'); return; } const p = getParams(); if (!checkConfig(p)) return; const msg = p.code + " descargarlista " + urlValue + " " + p.pass; addToHistory('descargarlista'); openTelegram(p.user, msg); urlInput.value = ''; } function copyToClipboard(text) { navigator.clipboard.writeText(text).then(() => { alert('Comando copiado al portapapeles'); }); } function openTelegram(botUser, message) { const encodedMsg = encodeURIComponent(message); const tgUrl = "tg://resolve?domain=" + botUser + "&text=" + encodedMsg; const webUrl = "https://t.me/" + botUser + "?text=" + encodedMsg; // Intentar abrir app window.location.href = tgUrl; // Fallback con opci贸n de copia manual setTimeout(function() { if (document.hasFocus()) { if (confirm('驩No se abri贸 Telegram? Puedes intentar abrir la versi贸n web o copiar el comando.')) { window.open(webUrl, '_blank'); } } }, 1000); } init();