feat: maneja comandos desconocidos con encabezado emoji y ayuda rápida

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
webui
brobert 2 weeks ago
parent b8979b8205
commit 3428fe930a

@ -5,7 +5,8 @@ import { TaskService } from '../tasks/service';
import { GroupSyncService } from './group-sync';
import { ContactsService } from './contacts';
import { ICONS } from '../utils/icons';
import { padTaskId, codeId, formatDDMM, bold, italic } from '../utils/formatting';
import { padTaskId, codeId, formatDDMM, bold, italic, code, section } from '../utils/formatting';
import { getQuickHelp } from './messages/help';
import { IdentityService } from './identity';
import { AllowedGroups } from './allowed-groups';
import { Metrics } from './metrics';
@ -1012,9 +1013,13 @@ export class CommandService {
}
if (action !== 'nueva') {
try { Metrics.inc('commands_unknown_total'); } catch {}
const header = `${section('Comando no reconocido')}`;
const cta = `Prueba ${code('/t ayuda')}`;
const help = getQuickHelp();
return [{
recipient: context.sender,
message: `Acción ${rawAction || '(vacía)'} no implementada aún`
message: [header, cta, '', help].join('\n')
}];
}

@ -0,0 +1,23 @@
import { describe, it, expect } from 'bun:test';
import { CommandService } from '../../../src/services/command';
describe('CommandService - comando desconocido devuelve ayuda rápida', () => {
it('responde con encabezado y CTA a /t ayuda incluyendo quick help', async () => {
const res = await CommandService.handle({
sender: '600000001',
groupId: '',
message: '/t qué tareas tengo hoy?',
mentions: [],
});
expect(Array.isArray(res)).toBe(true);
expect(res.length).toBeGreaterThan(0);
const msg = res[0].message;
expect(msg).toContain('COMANDO NO RECONOCIDO');
expect(msg).toContain('/t ayuda');
expect(msg).toContain('/t ver mis');
expect(msg).toContain('/t web');
expect(msg).toContain('/t configurar');
});
});
Loading…
Cancel
Save