feat: actualizar last_command_at al detectar cualquier /t

Co-authored-by: aider (openrouter/openai/gpt-5) <aider@aider.chat>
main
brobert 4 days ago
parent 1fafc431ff
commit a2fed2277c

@ -1373,6 +1373,16 @@ Nota: nunca respondo en grupos; solo por privado.`;
return { responses: [], ok: true }; return { responses: [], ok: true };
} }
// Registrar interacción del usuario (last_command_at) para cualquier comando /t …
try {
const ensured = ensureUserExists(context.sender, this.dbInstance);
if (ensured) {
try {
this.dbInstance.prepare(`UPDATE users SET last_command_at = strftime('%Y-%m-%d %H:%M:%f','now') WHERE id = ?`).run(ensured);
} catch {}
}
} catch {}
// Gating de grupos en modo 'enforce' (cuando CommandService se invoca directamente) // Gating de grupos en modo 'enforce' (cuando CommandService se invoca directamente)
if (isGroupId(context.groupId)) { if (isGroupId(context.groupId)) {
try { (AllowedGroups as any).dbInstance = this.dbInstance; } catch { } try { (AllowedGroups as any).dbInstance = this.dbInstance; } catch { }

@ -71,7 +71,7 @@ describe('Database', () => {
.query("PRAGMA table_info(users)") .query("PRAGMA table_info(users)")
.all() .all()
.map((c: any) => c.name); .map((c: any) => c.name);
expect(columns).toEqual(['id', 'first_seen', 'last_seen']); expect(columns).toEqual(['id', 'first_seen', 'last_seen', 'last_command_at']);
}); });
test('tasks table should have required columns', () => { test('tasks table should have required columns', () => {

Loading…
Cancel
Save