Files
lastwar/admin/comandos.php
nickpons666 2dd99c04dd Feature: Traducir todas las vistas - parte 1
- admin/recipients.php: tablas, modales, labels
- admin/comandos.php: títulos, tablas, descripciones
- admin/test_discord_connection.php: formularios, alertas
- admin/ia_agent.php: configuración, parámetros
- profile.php: información, formulario contraseña
- set_webhook.php: alertas, formularios
- chat_telegram.php: usuarios, historial
- translate_message.php: formulario de traducción
2026-02-20 16:01:06 -06:00

163 lines
6.5 KiB
PHP
Executable File

<?php
require_once __DIR__ . '/../includes/db.php';
require_once __DIR__ . '/../includes/session_check.php';
require_once __DIR__ . '/../includes/i18n.php';
requireAdmin();
$pageTitle = t('Gestión de Comandos');
$templates = [];
try {
$pdo = getDbConnection();
$stmt = $pdo->query("SELECT id, name, telegram_command FROM recurrent_messages ORDER BY name");
$templates = $stmt->fetchAll();
} catch (Exception $e) {
$error = $e->getMessage();
}
require_once __DIR__ . '/../templates/header.php';
?>
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-terminal"></i> <?= t('Gestión de Comandos') ?></h2>
</div>
<div class="alert alert-info">
<i class="bi bi-info-circle"></i> <?= t('Los comandos se usan en Discord y Telegram anteponiendo') ?> <code>#</code> <?= t('al nombre del comando') ?>.
</div>
<div class="row">
<div class="col-md-12">
<div class="card border-0 shadow-sm">
<div class="card-body">
<?php if (empty($templates)): ?>
<p class="text-muted text-center py-4"><?= t('No hay plantillas con comandos') ?></p>
<?php else: ?>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<th><?= t('Nombre') ?></th>
<th><?= t('Comando') ?></th>
<th><?= t('Uso') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($templates as $template): ?>
<tr>
<td><?= $template['id'] ?></td>
<td><?= htmlspecialchars($template['name']) ?></td>
<td>
<?php if ($template['telegram_command']): ?>
<code>#<?= htmlspecialchars($template['telegram_command']) ?></code>
<?php else: ?>
<span class="text-muted"><?= t('Sin comando') ?></span>
<?php endif; ?>
</td>
<td>
<span class="badge bg-primary">Discord</span>
<span class="badge bg-info">Telegram</span>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-md-12">
<div class="card border-0 shadow-sm">
<div class="card-header border-0">
<h5 class="mb-0"><i class="bi bi-discord"></i> <?= t('Comandos de Discord') ?></h5>
</div>
<div class="card-body">
<table class="table table-sm">
<thead>
<tr>
<th><?= t('Comando') ?></th>
<th><?= t('Descripción') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>#comando</code></td>
<td><?= t('Envía la plantilla asociada') ?></td>
</tr>
<tr>
<td><code>/comandos</code></td>
<td><?= t('Lista de comandos disponibles') ?></td>
</tr>
<tr>
<td><code>/setlang [código]</code></td>
<td><?= t('Establece el idioma del usuario') ?></td>
</tr>
<tr>
<td><code>/bienvenida</code></td>
<td><?= t('Envía mensaje de bienvenida') ?></td>
</tr>
<tr>
<td><code>/agente</code></td>
<td><?= t('Cambia a modo IA') ?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-md-12">
<div class="card border-0 shadow-sm">
<div class="card-header border-0">
<h5 class="mb-0"><i class="bi bi-telegram"></i> <?= t('Comandos de Telegram') ?></h5>
</div>
<div class="card-body">
<table class="table table-sm">
<thead>
<tr>
<th><?= t('Comando') ?></th>
<th><?= t('Descripción') ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>#comando</code></td>
<td><?= t('Envía la plantilla asociada') ?></td>
</tr>
<tr>
<td><code>/start</code></td>
<td><?= t('Inicia el bot') ?></td>
</tr>
<tr>
<td><code>/comandos</code></td>
<td><?= t('Lista de comandos disponibles') ?></td>
</tr>
<tr>
<td><code>/setlang [código]</code></td>
<td><?= t('Establece el idioma del usuario') ?></td>
</tr>
<tr>
<td><code>/bienvenida</code></td>
<td><?= t('Envía mensaje de bienvenida') ?></td>
</tr>
<tr>
<td><code>/agente</code></td>
<td><?= t('Cambia a modo IA') ?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php require_once __DIR__ . '/../templates/footer.php'; ?>