diff --git a/src/services/command.ts b/src/services/command.ts index e7915b4..a9e71a7 100644 --- a/src/services/command.ts +++ b/src/services/command.ts @@ -207,7 +207,53 @@ export class CommandService { const todayYMD = ymdInTZ(new Date()); if (!action || action === 'ayuda') { + const feature = String(process.env.FEATURE_HELP_V2 ?? 'true').toLowerCase(); + const helpV2Enabled = !['false', '0', 'no'].includes(feature); + const isAdvanced = (tokens[2] || '').toLowerCase() === 'avanzada'; + + // Fallback legacy (Help v1) + if (!helpV2Enabled) { + if (isAdvanced) { + const adv = [ + '*Ayuda avanzada:*', + 'Comandos y alias:', + ' · Crear: `n`, `nueva`, `crear`, `+`', + ' · Ver: `ver`, `mostrar`, `listar`, `ls` (opciones: `grupo` | `mis` | `todos` | `sin`)', + ' · Completar: `x`, `hecho`, `completar`, `done` (acepta varios IDs: "`/t x 14 19 24`" o "`/t x 14,19,24`"; máximo 10)', + ' · Tomar: `tomar`, `claim` (acepta varios IDs: "`/t tomar 12 19 50`" o "`/t tomar 12,19,50`"; máximo 10)', + ' · Soltar: `soltar`, `unassign`', + 'Preferencias:', + ' · `/t configurar diario|l-v|semanal|off [HH:MM]` (por defecto _08:30_; semanal: _lunes_; l-v: lunes a viernes)', + 'Notas:', + ' · En grupos, el bot responde por DM (no publica en el grupo).', + ' · Si creas una tarea en un grupo y no mencionas a nadie → “sin responsable”; en DM → se asigna a quien la cree.', + ' · Fechas dd/MM con ⚠️ si está vencida.', + ' · Mostramos los IDs de las tareas con 4 dígitos, pero puedes escribirlos sin ceros (p. ej., 26).', + ].join('\n'); + return [{ + recipient: context.sender, + message: adv + }]; + } + const help = [ + 'Guía rápida:', + '- Crear: `/t n Descripción 2028-11-26 @Ana`', + '- Ver grupo: `/t ver` (en el grupo)', + '- Ver mis tareas: `/t ver mis` (por DM)', + '- Ver todas: `/t ver todas` (por DM)', + '- Completar: `/t x 123` (máx. 10)', + '- Tomar: `/t tomar 12` (máx. 10)', + '- Configurar recordatorios: `/t configurar diario|l-v|semanal|off [HH:MM]`', + '- Ayuda avanzada: `/t ayuda avanzada`' + ].join('\n'); + return [{ + recipient: context.sender, + message: help + }]; + } + + // Help v2 if (isAdvanced) { return [{ recipient: context.sender, @@ -988,7 +1034,16 @@ export class CommandService { } if (action !== 'nueva') { + const feature = String(process.env.FEATURE_HELP_V2 ?? 'true').toLowerCase(); + const helpV2Enabled = !['false', '0', 'no'].includes(feature); + try { Metrics.inc('commands_unknown_total'); } catch {} + if (!helpV2Enabled) { + return [{ + recipient: context.sender, + message: `Acción ${rawAction || '(vacía)'} no implementada aún` + }]; + } const header = `❓ ${section('Comando no reconocido')}`; const cta = `Prueba ${code('/t ayuda')}`; const help = getQuickHelp();