@arcaelas/whatsapp 2.2.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/build/cjs/decorators.d.ts +9 -0
  2. package/build/cjs/decorators.js +26 -0
  3. package/build/cjs/decorators.js.map +1 -0
  4. package/build/cjs/index.d.ts +6 -10
  5. package/build/cjs/index.js +11 -10
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/lib/bot/decorator.d.ts +77 -0
  8. package/build/cjs/lib/bot/decorator.js +219 -0
  9. package/build/cjs/lib/bot/decorator.js.map +1 -0
  10. package/build/cjs/lib/bot/decorators.d.ts +113 -0
  11. package/build/cjs/lib/bot/decorators.js +253 -0
  12. package/build/cjs/lib/bot/decorators.js.map +1 -0
  13. package/build/cjs/lib/bot/index.d.ts +3 -0
  14. package/build/cjs/lib/bot/index.js +20 -0
  15. package/build/cjs/lib/bot/index.js.map +1 -0
  16. package/build/cjs/lib/chat/index.d.ts +227 -0
  17. package/build/cjs/lib/chat/index.js +324 -0
  18. package/build/cjs/lib/chat/index.js.map +1 -0
  19. package/build/cjs/lib/contact/index.d.ts +203 -0
  20. package/build/cjs/lib/contact/index.js +226 -0
  21. package/build/cjs/lib/contact/index.js.map +1 -0
  22. package/build/cjs/lib/message/index.d.ts +237 -0
  23. package/build/cjs/lib/message/index.js +685 -0
  24. package/build/cjs/lib/message/index.js.map +1 -0
  25. package/build/cjs/lib/store/engine/index.d.ts +34 -0
  26. package/build/cjs/lib/store/engine/index.js +13 -0
  27. package/build/cjs/lib/store/engine/index.js.map +1 -0
  28. package/build/cjs/lib/store/engine/lib/file_system/index.d.ts +56 -0
  29. package/build/cjs/lib/store/engine/lib/file_system/index.js +160 -0
  30. package/build/cjs/lib/store/engine/lib/file_system/index.js.map +1 -0
  31. package/build/cjs/lib/store/engine/lib/redis/index.d.ts +82 -0
  32. package/build/cjs/lib/store/engine/lib/redis/index.js +132 -0
  33. package/build/cjs/lib/store/engine/lib/redis/index.js.map +1 -0
  34. package/build/cjs/lib/store/index.d.ts +22 -0
  35. package/build/cjs/lib/store/index.js +38 -0
  36. package/build/cjs/lib/store/index.js.map +1 -0
  37. package/build/cjs/lib/whatsapp/index.d.ts +179 -0
  38. package/build/cjs/lib/whatsapp/index.js +754 -0
  39. package/build/cjs/lib/whatsapp/index.js.map +1 -0
  40. package/build/esm/decorators.d.ts +9 -0
  41. package/build/esm/decorators.js +9 -0
  42. package/build/esm/decorators.js.map +1 -0
  43. package/build/esm/index.d.ts +6 -10
  44. package/build/esm/index.js +4 -6
  45. package/build/esm/index.js.map +1 -1
  46. package/build/esm/lib/bot/decorator.d.ts +77 -0
  47. package/build/esm/lib/bot/decorator.js +210 -0
  48. package/build/esm/lib/bot/decorator.js.map +1 -0
  49. package/build/esm/lib/bot/decorators.d.ts +113 -0
  50. package/build/esm/lib/bot/decorators.js +242 -0
  51. package/build/esm/lib/bot/decorators.js.map +1 -0
  52. package/build/esm/lib/bot/index.d.ts +3 -0
  53. package/build/esm/lib/bot/index.js +3 -0
  54. package/build/esm/lib/bot/index.js.map +1 -0
  55. package/build/esm/lib/chat/index.d.ts +227 -0
  56. package/build/esm/lib/chat/index.js +319 -0
  57. package/build/esm/lib/chat/index.js.map +1 -0
  58. package/build/esm/lib/contact/index.d.ts +203 -0
  59. package/build/esm/lib/contact/index.js +221 -0
  60. package/build/esm/lib/contact/index.js.map +1 -0
  61. package/build/esm/lib/message/index.d.ts +237 -0
  62. package/build/esm/lib/message/index.js +673 -0
  63. package/build/esm/lib/message/index.js.map +1 -0
  64. package/build/esm/lib/store/engine/index.d.ts +34 -0
  65. package/build/esm/lib/store/engine/index.js +8 -0
  66. package/build/esm/lib/store/engine/index.js.map +1 -0
  67. package/build/esm/lib/store/engine/lib/file_system/index.d.ts +56 -0
  68. package/build/esm/lib/store/engine/lib/file_system/index.js +156 -0
  69. package/build/esm/lib/store/engine/lib/file_system/index.js.map +1 -0
  70. package/build/esm/lib/store/engine/lib/redis/index.d.ts +82 -0
  71. package/build/esm/lib/store/engine/lib/redis/index.js +128 -0
  72. package/build/esm/lib/store/engine/lib/redis/index.js.map +1 -0
  73. package/build/esm/lib/store/index.d.ts +22 -0
  74. package/build/esm/lib/store/index.js +31 -0
  75. package/build/esm/lib/store/index.js.map +1 -0
  76. package/build/esm/lib/whatsapp/index.d.ts +179 -0
  77. package/build/esm/lib/whatsapp/index.js +714 -0
  78. package/build/esm/lib/whatsapp/index.js.map +1 -0
  79. package/package.json +8 -6
  80. package/build/cjs/Chat.d.ts +0 -317
  81. package/build/cjs/Chat.js +0 -275
  82. package/build/cjs/Chat.js.map +0 -1
  83. package/build/cjs/Contact.d.ts +0 -1163
  84. package/build/cjs/Contact.js +0 -162
  85. package/build/cjs/Contact.js.map +0 -1
  86. package/build/cjs/Message.d.ts +0 -902
  87. package/build/cjs/Message.js +0 -515
  88. package/build/cjs/Message.js.map +0 -1
  89. package/build/cjs/WhatsApp.d.ts +0 -80
  90. package/build/cjs/WhatsApp.js +0 -412
  91. package/build/cjs/WhatsApp.js.map +0 -1
  92. package/build/cjs/store/driver/FileEngine.d.ts +0 -34
  93. package/build/cjs/store/driver/FileEngine.js +0 -86
  94. package/build/cjs/store/driver/FileEngine.js.map +0 -1
  95. package/build/cjs/store/driver/RedisEngine.d.ts +0 -47
  96. package/build/cjs/store/driver/RedisEngine.js +0 -70
  97. package/build/cjs/store/driver/RedisEngine.js.map +0 -1
  98. package/build/cjs/store/engine.d.ts +0 -53
  99. package/build/cjs/store/engine.js +0 -7
  100. package/build/cjs/store/engine.js.map +0 -1
  101. package/build/cjs/store/index.d.ts +0 -8
  102. package/build/cjs/store/index.js +0 -12
  103. package/build/cjs/store/index.js.map +0 -1
  104. package/build/esm/Chat.d.ts +0 -317
  105. package/build/esm/Chat.js +0 -270
  106. package/build/esm/Chat.js.map +0 -1
  107. package/build/esm/Contact.d.ts +0 -1163
  108. package/build/esm/Contact.js +0 -157
  109. package/build/esm/Contact.js.map +0 -1
  110. package/build/esm/Message.d.ts +0 -902
  111. package/build/esm/Message.js +0 -510
  112. package/build/esm/Message.js.map +0 -1
  113. package/build/esm/WhatsApp.d.ts +0 -80
  114. package/build/esm/WhatsApp.js +0 -372
  115. package/build/esm/WhatsApp.js.map +0 -1
  116. package/build/esm/store/driver/FileEngine.d.ts +0 -34
  117. package/build/esm/store/driver/FileEngine.js +0 -82
  118. package/build/esm/store/driver/FileEngine.js.map +0 -1
  119. package/build/esm/store/driver/RedisEngine.d.ts +0 -47
  120. package/build/esm/store/driver/RedisEngine.js +0 -66
  121. package/build/esm/store/driver/RedisEngine.js.map +0 -1
  122. package/build/esm/store/engine.d.ts +0 -53
  123. package/build/esm/store/engine.js +0 -6
  124. package/build/esm/store/engine.js.map +0 -1
  125. package/build/esm/store/index.d.ts +0 -8
  126. package/build/esm/store/index.js +0 -7
  127. package/build/esm/store/index.js.map +0 -1
@@ -1,70 +0,0 @@
1
- "use strict";
2
- /**
3
- * @file store/driver/RedisEngine.ts
4
- * @description Engine de persistencia con Redis
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.RedisEngine = void 0;
8
- /**
9
- * @description
10
- * Engine de persistencia con Redis.
11
- * Recibe una conexión existente de ioredis o redis.
12
- *
13
- * Redis persistence engine.
14
- * Receives an existing ioredis or redis connection.
15
- *
16
- * @example
17
- * import Redis from 'ioredis';
18
- * const client = new Redis();
19
- * const engine = new RedisEngine(client, 'wa:5491112345678');
20
- * await engine.set('contact/123', '{"name":"John"}');
21
- */
22
- class RedisEngine {
23
- constructor(_client, _prefix = 'wa:default') {
24
- this._client = _client;
25
- this._prefix = _prefix;
26
- }
27
- /** @description Obtiene un valor por su key. / Retrieves a value by its key. */
28
- async get(key) {
29
- return this._client.get(`${this._prefix}:${key}`);
30
- }
31
- /**
32
- * @description Guarda o elimina un valor. Si value es null, elimina la key y todas las sub-keys con ese prefijo.
33
- * Saves or deletes a value. If value is null, deletes the key and all sub-keys matching the prefix.
34
- */
35
- async set(key, value) {
36
- const full_key = `${this._prefix}:${key}`;
37
- if (value) {
38
- await this._client.set(full_key, value);
39
- }
40
- else {
41
- await this._client.del(full_key);
42
- const pattern = `${full_key}/*`;
43
- let cursor = '0';
44
- do {
45
- const [next, batch] = await this._client.scan(cursor, 'MATCH', pattern, 'COUNT', 100);
46
- cursor = next;
47
- if (batch.length)
48
- await this._client.del(batch);
49
- } while (cursor !== '0');
50
- }
51
- }
52
- /**
53
- * @description Lista keys bajo un prefijo.
54
- * Lists keys under a prefix.
55
- * @note Redis SCAN no garantiza orden. / Redis SCAN does not guarantee order.
56
- */
57
- async list(prefix, offset = 0, limit = 50) {
58
- const pattern = `${this._prefix}:${prefix}*`;
59
- const keys = [];
60
- let cursor = '0';
61
- do {
62
- const [next, batch] = await this._client.scan(cursor, 'MATCH', pattern, 'COUNT', 100);
63
- cursor = next;
64
- keys.push(...batch);
65
- } while (cursor !== '0' && keys.length < offset + limit + 100);
66
- return keys.map((k) => k.slice(this._prefix.length + 1)).slice(offset, offset + limit);
67
- }
68
- }
69
- exports.RedisEngine = RedisEngine;
70
- //# sourceMappingURL=RedisEngine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RedisEngine.js","sourceRoot":"","sources":["../../../../src/store/driver/RedisEngine.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH;;;;;;;;;;;;;GAaG;AACH,MAAa,WAAW;IACpB,YAA6B,OAAoB,EAAmB,UAAkB,YAAY;QAArE,YAAO,GAAP,OAAO,CAAa;QAAmB,YAAO,GAAP,OAAO,CAAuB;IAAI,CAAC;IAEvG,gFAAgF;IAChF,KAAK,CAAC,GAAG,CAAC,GAAW;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC;IACtD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAoB;QACvC,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,GAAG,EAAE,CAAC;QAC1C,IAAI,KAAK,EAAE,CAAC;YACR,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACjC,MAAM,OAAO,GAAG,GAAG,QAAQ,IAAI,CAAC;YAChC,IAAI,MAAM,GAAG,GAAG,CAAC;YACjB,GAAG,CAAC;gBACA,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;gBACtF,MAAM,GAAG,IAAI,CAAC;gBACd,IAAI,KAAK,CAAC,MAAM;oBAAE,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACpD,CAAC,QAAQ,MAAM,KAAK,GAAG,EAAE;QAC7B,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,MAAc,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE;QAC7C,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,MAAM,GAAG,CAAC;QAC7C,MAAM,IAAI,GAAa,EAAE,CAAC;QAC1B,IAAI,MAAM,GAAG,GAAG,CAAC;QACjB,GAAG,CAAC;YACA,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;YACtF,MAAM,GAAG,IAAI,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QACxB,CAAC,QAAQ,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,GAAG,EAAE;QAC/D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;IAC3F,CAAC;CACJ;AA5CD,kCA4CC"}
@@ -1,53 +0,0 @@
1
- /**
2
- * @file store/engine.ts
3
- * @description Interface Engine - contrato para proveedores de persistencia key-value
4
- */
5
- /**
6
- * @description
7
- * Interface que define el contrato para proveedores de persistencia.
8
- * Almacena texto (JSON stringified con BufferJSON para binarios).
9
- *
10
- * Interface that defines the contract for persistence providers.
11
- * Stores plain text (JSON stringified with BufferJSON for binaries).
12
- *
13
- * @example
14
- * class CustomEngine implements Engine {
15
- * async get(key: string): Promise<string | null> {
16
- * return localStorage.getItem(key);
17
- * }
18
- *
19
- * async set(key: string, value: string | null): Promise<void> {
20
- * if (value === null) localStorage.removeItem(key);
21
- * else localStorage.setItem(key, value);
22
- * }
23
- *
24
- * async list(prefix: string, offset?: number, limit?: number): Promise<string[]> {
25
- * return Object.keys(localStorage).filter(k => k.startsWith(prefix));
26
- * }
27
- * }
28
- */
29
- export interface Engine {
30
- /**
31
- * @description Obtiene un valor por su key.
32
- * Retrieves a value by its key.
33
- * @param key Ruta del documento (ej: 'creds', 'contact/123@s.whatsapp.net').
34
- * @returns Texto JSON o null si no existe.
35
- */
36
- get(key: string): Promise<string | null>;
37
- /**
38
- * @description Guarda o elimina un valor. Si value es null, elimina la key y todas las sub-keys recursivamente.
39
- * Saves or deletes a value. If value is null, deletes the key and all sub-keys recursively.
40
- * @param key Ruta del documento.
41
- * @param value Texto a guardar o null para eliminar recursivamente.
42
- */
43
- set(key: string, value: string | null): Promise<void>;
44
- /**
45
- * @description Lista keys bajo un prefijo, ordenados por más reciente.
46
- * Lists keys under a prefix, ordered by most recent.
47
- * @param prefix Prefijo de búsqueda (ej: 'contact/', 'chat/123/message/').
48
- * @param offset Inicio de paginación (default: 0).
49
- * @param limit Cantidad máxima (default: 50).
50
- * @returns Array de keys.
51
- */
52
- list(prefix: string, offset?: number, limit?: number): Promise<string[]>;
53
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * @file store/engine.ts
4
- * @description Interface Engine - contrato para proveedores de persistencia key-value
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=engine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/store/engine.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -1,8 +0,0 @@
1
- /**
2
- * @file store/index.ts
3
- * @description Exportaciones del módulo de persistencia
4
- */
5
- export { FileEngine } from '../store/driver/FileEngine';
6
- export { RedisEngine } from '../store/driver/RedisEngine';
7
- export type { RedisClient } from '../store/driver/RedisEngine';
8
- export type { Engine } from '../store/engine';
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /**
3
- * @file store/index.ts
4
- * @description Exportaciones del módulo de persistencia
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.RedisEngine = exports.FileEngine = void 0;
8
- var FileEngine_1 = require("../store/driver/FileEngine");
9
- Object.defineProperty(exports, "FileEngine", { enumerable: true, get: function () { return FileEngine_1.FileEngine; } });
10
- var RedisEngine_1 = require("../store/driver/RedisEngine");
11
- Object.defineProperty(exports, "RedisEngine", { enumerable: true, get: function () { return RedisEngine_1.RedisEngine; } });
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,wDAAuD;AAA9C,wGAAA,UAAU,OAAA;AACnB,0DAAyD;AAAhD,0GAAA,WAAW,OAAA"}
@@ -1,317 +0,0 @@
1
- /**
2
- * @file Chat.ts
3
- * @description Clase Chat para gestión de conversaciones de WhatsApp
4
- */
5
- import type { WhatsApp } from './WhatsApp';
6
- /**
7
- * @description Participante de grupo.
8
- * Group participant.
9
- */
10
- export interface IGroupParticipant {
11
- /** JID del participante / Participant JID */
12
- id: string;
13
- /** Rol de admin: null, 'admin', 'superadmin' / Admin role */
14
- admin: string | null;
15
- }
16
- /**
17
- * @description Objeto raw del chat (protocolo).
18
- * Raw chat object (protocol).
19
- */
20
- export interface IChatRaw {
21
- /** JID único del chat / Unique chat JID */
22
- id: string;
23
- /** Nombre del chat o grupo / Chat or group name */
24
- name?: string | null;
25
- /** Nombre alternativo para mostrar / Alternative display name */
26
- displayName?: string | null;
27
- /** Descripción del grupo / Group description */
28
- description?: string | null;
29
- /** Cantidad de mensajes no leídos / Unread message count */
30
- unreadCount?: number | null;
31
- /** Si el chat es de solo lectura / Whether the chat is read-only */
32
- readOnly?: boolean | null;
33
- /** Si el chat está archivado / Whether the chat is archived */
34
- archived?: boolean | null;
35
- /** Timestamp cuando se fijó el chat / Pin timestamp */
36
- pinned?: number | null;
37
- /** Timestamp cuando expira el silencio / Mute end timestamp */
38
- muteEndTime?: number | null;
39
- /** Si fue marcado manualmente como no leído / Whether manually marked as unread */
40
- markedAsUnread?: boolean | null;
41
- /** Lista de participantes del grupo / Group participant list */
42
- participant?: IGroupParticipant[] | null;
43
- /** JID del creador del grupo / Group creator JID */
44
- createdBy?: string | null;
45
- /** Timestamp de creación / Creation timestamp */
46
- createdAt?: number | null;
47
- /** Duración de mensajes temporales (segundos) / Ephemeral message duration (seconds) */
48
- ephemeralExpiration?: number | null;
49
- }
50
- /**
51
- * @description
52
- * Clase base para representar una conversación de WhatsApp.
53
- * Base class representing a WhatsApp conversation.
54
- */
55
- export declare class Chat {
56
- readonly raw: IChatRaw;
57
- constructor(raw: IChatRaw);
58
- /** JID único del chat / Unique chat JID */
59
- get id(): string;
60
- /** Tipo de chat / Chat type */
61
- get type(): 'contact' | 'group';
62
- /** Nombre del chat / Chat name */
63
- get name(): string;
64
- /** Descripción del chat/grupo / Chat/group description */
65
- get content(): string;
66
- /** Si está fijado / Whether it's pinned */
67
- get pinned(): boolean;
68
- /** Si está archivado / Whether it's archived */
69
- get archived(): boolean;
70
- /** Timestamp cuando expira el silencio (0 = no silenciado) / Mute end timestamp (0 = not muted) */
71
- get muted(): number;
72
- /** Si está leído / Whether it's read */
73
- get read(): boolean;
74
- /** Si es solo lectura / Whether it's read-only */
75
- get readonly(): boolean;
76
- }
77
- /**
78
- * @description Factory que retorna la clase Chat enlazada al contexto.
79
- * Factory that returns the Chat class bound to context.
80
- * @param wa Instancia de WhatsApp.
81
- */
82
- export declare function chat(wa: WhatsApp): {
83
- new (raw: IChatRaw): {
84
- /**
85
- * @description Actualiza los datos del chat desde WhatsApp.
86
- * Refreshes chat data from WhatsApp.
87
- */
88
- refresh(): Promise</*elided*/ any | null>;
89
- /**
90
- * @description Elimina el chat con cascade delete.
91
- * Deletes the chat with cascade delete.
92
- */
93
- remove(): Promise<boolean>;
94
- /**
95
- * @description Fija o desfija el chat.
96
- * Pins or unpins the chat.
97
- */
98
- pin(value: boolean): Promise<boolean>;
99
- /**
100
- * @description Archiva o desarchiva el chat.
101
- * Archives or unarchives the chat.
102
- */
103
- archive(value: boolean): Promise<boolean>;
104
- /**
105
- * @description Silencia o quita silencio del chat.
106
- * Mutes or unmutes the chat.
107
- * @param duration Duración en ms (0 o null para quitar silencio) / Duration in ms (0 or null to unmute).
108
- */
109
- mute(duration: number | null): Promise<boolean>;
110
- /**
111
- * @description Marca el chat como leído.
112
- * Marks the chat as read.
113
- */
114
- seen(): Promise<boolean>;
115
- /**
116
- * @description Obtiene los miembros del chat.
117
- * Gets chat members.
118
- */
119
- members(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Contact>[]>;
120
- /**
121
- * @description Obtiene mensajes del chat (paginados).
122
- * Gets chat messages (paginated).
123
- */
124
- messages(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Message>[]>;
125
- /**
126
- * @description Obtiene el contacto asociado al chat (solo chats individuales).
127
- * Gets the contact associated with the chat (individual chats only).
128
- */
129
- contact(): Promise<InstanceType<typeof wa.Contact> | null>;
130
- readonly raw: IChatRaw;
131
- /** JID único del chat / Unique chat JID */
132
- get id(): string;
133
- /** Tipo de chat / Chat type */
134
- get type(): "contact" | "group";
135
- /** Nombre del chat / Chat name */
136
- get name(): string;
137
- /** Descripción del chat/grupo / Chat/group description */
138
- get content(): string;
139
- /** Si está fijado / Whether it's pinned */
140
- get pinned(): boolean;
141
- /** Si está archivado / Whether it's archived */
142
- get archived(): boolean;
143
- /** Timestamp cuando expira el silencio (0 = no silenciado) / Mute end timestamp (0 = not muted) */
144
- get muted(): number;
145
- /** Si está leído / Whether it's read */
146
- get read(): boolean;
147
- /** Si es solo lectura / Whether it's read-only */
148
- get readonly(): boolean;
149
- };
150
- /**
151
- * @description Obtiene un chat por su ID.
152
- * Retrieves a chat by its ID.
153
- */
154
- get(cid: string): Promise<{
155
- /**
156
- * @description Actualiza los datos del chat desde WhatsApp.
157
- * Refreshes chat data from WhatsApp.
158
- */
159
- refresh(): Promise</*elided*/ any | null>;
160
- /**
161
- * @description Elimina el chat con cascade delete.
162
- * Deletes the chat with cascade delete.
163
- */
164
- remove(): Promise<boolean>;
165
- /**
166
- * @description Fija o desfija el chat.
167
- * Pins or unpins the chat.
168
- */
169
- pin(value: boolean): Promise<boolean>;
170
- /**
171
- * @description Archiva o desarchiva el chat.
172
- * Archives or unarchives the chat.
173
- */
174
- archive(value: boolean): Promise<boolean>;
175
- /**
176
- * @description Silencia o quita silencio del chat.
177
- * Mutes or unmutes the chat.
178
- * @param duration Duración en ms (0 o null para quitar silencio) / Duration in ms (0 or null to unmute).
179
- */
180
- mute(duration: number | null): Promise<boolean>;
181
- /**
182
- * @description Marca el chat como leído.
183
- * Marks the chat as read.
184
- */
185
- seen(): Promise<boolean>;
186
- /**
187
- * @description Obtiene los miembros del chat.
188
- * Gets chat members.
189
- */
190
- members(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Contact>[]>;
191
- /**
192
- * @description Obtiene mensajes del chat (paginados).
193
- * Gets chat messages (paginated).
194
- */
195
- messages(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Message>[]>;
196
- /**
197
- * @description Obtiene el contacto asociado al chat (solo chats individuales).
198
- * Gets the contact associated with the chat (individual chats only).
199
- */
200
- contact(): Promise<InstanceType<typeof wa.Contact> | null>;
201
- readonly raw: IChatRaw;
202
- /** JID único del chat / Unique chat JID */
203
- get id(): string;
204
- /** Tipo de chat / Chat type */
205
- get type(): "contact" | "group";
206
- /** Nombre del chat / Chat name */
207
- get name(): string;
208
- /** Descripción del chat/grupo / Chat/group description */
209
- get content(): string;
210
- /** Si está fijado / Whether it's pinned */
211
- get pinned(): boolean;
212
- /** Si está archivado / Whether it's archived */
213
- get archived(): boolean;
214
- /** Timestamp cuando expira el silencio (0 = no silenciado) / Mute end timestamp (0 = not muted) */
215
- get muted(): number;
216
- /** Si está leído / Whether it's read */
217
- get read(): boolean;
218
- /** Si es solo lectura / Whether it's read-only */
219
- get readonly(): boolean;
220
- } | null>;
221
- /**
222
- * @description Obtiene chats paginados.
223
- * Retrieves paginated chats.
224
- */
225
- list(offset?: number, limit?: number): Promise<{
226
- /**
227
- * @description Actualiza los datos del chat desde WhatsApp.
228
- * Refreshes chat data from WhatsApp.
229
- */
230
- refresh(): Promise</*elided*/ any | null>;
231
- /**
232
- * @description Elimina el chat con cascade delete.
233
- * Deletes the chat with cascade delete.
234
- */
235
- remove(): Promise<boolean>;
236
- /**
237
- * @description Fija o desfija el chat.
238
- * Pins or unpins the chat.
239
- */
240
- pin(value: boolean): Promise<boolean>;
241
- /**
242
- * @description Archiva o desarchiva el chat.
243
- * Archives or unarchives the chat.
244
- */
245
- archive(value: boolean): Promise<boolean>;
246
- /**
247
- * @description Silencia o quita silencio del chat.
248
- * Mutes or unmutes the chat.
249
- * @param duration Duración en ms (0 o null para quitar silencio) / Duration in ms (0 or null to unmute).
250
- */
251
- mute(duration: number | null): Promise<boolean>;
252
- /**
253
- * @description Marca el chat como leído.
254
- * Marks the chat as read.
255
- */
256
- seen(): Promise<boolean>;
257
- /**
258
- * @description Obtiene los miembros del chat.
259
- * Gets chat members.
260
- */
261
- members(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Contact>[]>;
262
- /**
263
- * @description Obtiene mensajes del chat (paginados).
264
- * Gets chat messages (paginated).
265
- */
266
- messages(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Message>[]>;
267
- /**
268
- * @description Obtiene el contacto asociado al chat (solo chats individuales).
269
- * Gets the contact associated with the chat (individual chats only).
270
- */
271
- contact(): Promise<InstanceType<typeof wa.Contact> | null>;
272
- readonly raw: IChatRaw;
273
- /** JID único del chat / Unique chat JID */
274
- get id(): string;
275
- /** Tipo de chat / Chat type */
276
- get type(): "contact" | "group";
277
- /** Nombre del chat / Chat name */
278
- get name(): string;
279
- /** Descripción del chat/grupo / Chat/group description */
280
- get content(): string;
281
- /** Si está fijado / Whether it's pinned */
282
- get pinned(): boolean;
283
- /** Si está archivado / Whether it's archived */
284
- get archived(): boolean;
285
- /** Timestamp cuando expira el silencio (0 = no silenciado) / Mute end timestamp (0 = not muted) */
286
- get muted(): number;
287
- /** Si está leído / Whether it's read */
288
- get read(): boolean;
289
- /** Si es solo lectura / Whether it's read-only */
290
- get readonly(): boolean;
291
- }[]>;
292
- /**
293
- * @description Fija o desfija un chat por su ID.
294
- * Pins or unpins a chat by its ID.
295
- */
296
- pin(cid: string, value: boolean): Promise<boolean>;
297
- /**
298
- * @description Archiva o desarchiva un chat por su ID.
299
- * Archives or unarchives a chat by its ID.
300
- */
301
- archive(cid: string, value: boolean): Promise<boolean>;
302
- /**
303
- * @description Silencia o quita silencio de un chat por su ID.
304
- * Mutes or unmutes a chat by its ID.
305
- */
306
- mute(cid: string, duration: number | null): Promise<boolean>;
307
- /**
308
- * @description Marca un chat como leido por su ID.
309
- * Marks a chat as read by its ID.
310
- */
311
- seen(cid: string): Promise<boolean>;
312
- /**
313
- * @description Elimina un chat por su ID.
314
- * Removes a chat by its ID.
315
- */
316
- remove(cid: string): Promise<boolean>;
317
- };