@arcaelas/whatsapp 4.5.0 → 6.0.0
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.
- package/README.md +282 -239
- package/build/cjs/decorators.js +0 -1
- package/build/cjs/index.d.ts +6 -4
- package/build/cjs/index.js +22 -3
- package/build/cjs/lib/bot/decorator.d.ts +2 -0
- package/build/cjs/lib/bot/decorator.js +6 -1
- package/build/cjs/lib/bot/decorators.d.ts +2 -2
- package/build/cjs/lib/bot/decorators.js +4 -4
- package/build/cjs/lib/bot/index.js +0 -1
- package/build/cjs/lib/chat/index.d.ts +381 -204
- package/build/cjs/lib/chat/index.js +243 -212
- package/build/cjs/lib/contact/index.d.ts +162 -179
- package/build/cjs/lib/contact/index.js +96 -191
- package/build/cjs/lib/internal.d.ts +40 -0
- package/build/cjs/lib/internal.js +38 -0
- package/build/cjs/lib/message/index.d.ts +468 -289
- package/build/cjs/lib/message/index.js +871 -743
- package/build/cjs/lib/status/index.d.ts +60 -70
- package/build/cjs/lib/status/index.js +106 -112
- package/build/cjs/lib/store/engine/index.d.ts +35 -7
- package/build/cjs/lib/store/engine/index.js +6 -4
- package/build/cjs/lib/store/engine/lib/file_system/index.d.ts +48 -8
- package/build/cjs/lib/store/engine/lib/file_system/index.js +117 -66
- package/build/cjs/lib/store/engine/lib/index.d.ts +112 -0
- package/build/cjs/lib/store/engine/lib/index.js +212 -0
- package/build/cjs/lib/store/engine/lib/redis/index.d.ts +44 -15
- package/build/cjs/lib/store/engine/lib/redis/index.js +75 -43
- package/build/cjs/lib/store/engine/lib/s3/index.d.ts +44 -1
- package/build/cjs/lib/store/engine/lib/s3/index.js +112 -65
- package/build/cjs/lib/store/engine/lib/sqlite/index.d.ts +110 -0
- package/build/cjs/lib/store/engine/lib/sqlite/index.js +132 -0
- package/build/cjs/lib/store/index.d.ts +7 -3
- package/build/cjs/lib/store/index.js +14 -5
- package/build/cjs/lib/whatsapp/index.d.ts +106 -68
- package/build/cjs/lib/whatsapp/index.js +393 -167
- package/build/esm/decorators.js +0 -1
- package/build/esm/index.d.ts +6 -4
- package/build/esm/index.js +5 -3
- package/build/esm/lib/bot/decorator.d.ts +2 -0
- package/build/esm/lib/bot/decorator.js +6 -1
- package/build/esm/lib/bot/decorators.d.ts +2 -2
- package/build/esm/lib/bot/decorators.js +4 -4
- package/build/esm/lib/bot/index.js +0 -1
- package/build/esm/lib/chat/index.d.ts +381 -204
- package/build/esm/lib/chat/index.js +243 -212
- package/build/esm/lib/contact/index.d.ts +162 -179
- package/build/esm/lib/contact/index.js +96 -190
- package/build/esm/lib/internal.d.ts +40 -0
- package/build/esm/lib/internal.js +34 -0
- package/build/esm/lib/message/index.d.ts +468 -289
- package/build/esm/lib/message/index.js +866 -738
- package/build/esm/lib/status/index.d.ts +60 -70
- package/build/esm/lib/status/index.js +105 -111
- package/build/esm/lib/store/engine/index.d.ts +35 -7
- package/build/esm/lib/store/engine/index.js +4 -3
- package/build/esm/lib/store/engine/lib/file_system/index.d.ts +48 -8
- package/build/esm/lib/store/engine/lib/file_system/index.js +117 -66
- package/build/esm/lib/store/engine/lib/index.d.ts +112 -0
- package/build/esm/lib/store/engine/lib/index.js +205 -0
- package/build/esm/lib/store/engine/lib/redis/index.d.ts +44 -15
- package/build/esm/lib/store/engine/lib/redis/index.js +73 -41
- package/build/esm/lib/store/engine/lib/s3/index.d.ts +44 -1
- package/build/esm/lib/store/engine/lib/s3/index.js +111 -64
- package/build/esm/lib/store/engine/lib/sqlite/index.d.ts +110 -0
- package/build/esm/lib/store/engine/lib/sqlite/index.js +128 -0
- package/build/esm/lib/store/index.d.ts +7 -3
- package/build/esm/lib/store/index.js +13 -5
- package/build/esm/lib/whatsapp/index.d.ts +106 -68
- package/build/esm/lib/whatsapp/index.js +395 -169
- package/package.json +25 -6
- package/build/cjs/decorators.js.map +0 -1
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/lib/bot/decorator.js.map +0 -1
- package/build/cjs/lib/bot/decorators.js.map +0 -1
- package/build/cjs/lib/bot/index.js.map +0 -1
- package/build/cjs/lib/chat/index.js.map +0 -1
- package/build/cjs/lib/contact/index.js.map +0 -1
- package/build/cjs/lib/message/index.js.map +0 -1
- package/build/cjs/lib/status/index.js.map +0 -1
- package/build/cjs/lib/store/engine/index.js.map +0 -1
- package/build/cjs/lib/store/engine/lib/file_system/index.js.map +0 -1
- package/build/cjs/lib/store/engine/lib/redis/index.js.map +0 -1
- package/build/cjs/lib/store/engine/lib/s3/index.js.map +0 -1
- package/build/cjs/lib/store/index.js.map +0 -1
- package/build/cjs/lib/whatsapp/index.js.map +0 -1
- package/build/cjs/test.d.ts +0 -1
- package/build/cjs/test.js +0 -71
- package/build/cjs/test.js.map +0 -1
- package/build/esm/decorators.js.map +0 -1
- package/build/esm/index.js.map +0 -1
- package/build/esm/lib/bot/decorator.js.map +0 -1
- package/build/esm/lib/bot/decorators.js.map +0 -1
- package/build/esm/lib/bot/index.js.map +0 -1
- package/build/esm/lib/chat/index.js.map +0 -1
- package/build/esm/lib/contact/index.js.map +0 -1
- package/build/esm/lib/message/index.js.map +0 -1
- package/build/esm/lib/status/index.js.map +0 -1
- package/build/esm/lib/store/engine/index.js.map +0 -1
- package/build/esm/lib/store/engine/lib/file_system/index.js.map +0 -1
- package/build/esm/lib/store/engine/lib/redis/index.js.map +0 -1
- package/build/esm/lib/store/engine/lib/s3/index.js.map +0 -1
- package/build/esm/lib/store/index.js.map +0 -1
- package/build/esm/lib/whatsapp/index.js.map +0 -1
- package/build/esm/test.d.ts +0 -1
- package/build/esm/test.js +0 -66
- package/build/esm/test.js.map +0 -1
|
@@ -3,64 +3,49 @@
|
|
|
3
3
|
* @description Entidad Chat — conversaciones individuales y grupales.
|
|
4
4
|
* Chat entity — individual and group conversations.
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import { Message } from '../../lib/message';
|
|
7
7
|
import type { WhatsApp } from '../../lib/whatsapp';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
export interface GroupParticipant {
|
|
13
|
-
id: string;
|
|
14
|
-
admin: string | null;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Shape persistido del chat (snake_case).
|
|
18
|
-
* Persisted chat shape (snake_case).
|
|
19
|
-
*/
|
|
20
|
-
export interface IChatRaw {
|
|
21
|
-
id: string;
|
|
22
|
-
name?: string | null;
|
|
23
|
-
display_name?: string | null;
|
|
24
|
-
description?: string | null;
|
|
25
|
-
unread_count?: number | null;
|
|
26
|
-
read_only?: boolean | null;
|
|
27
|
-
archived?: boolean | null;
|
|
28
|
-
pinned?: number | null;
|
|
29
|
-
mute_end_time?: number | null;
|
|
30
|
-
marked_as_unread?: boolean | null;
|
|
31
|
-
participants?: GroupParticipant[] | null;
|
|
32
|
-
created_by?: string | null;
|
|
33
|
-
created_at?: number | null;
|
|
34
|
-
ephemeral_expiration?: number | null;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Clase base del chat (forma pública, solo lectura).
|
|
38
|
-
* Base Chat class (public shape, read-only).
|
|
9
|
+
* Clase base del chat: recibe el raw y deriva todo con getters.
|
|
10
|
+
* Base Chat class: receives the raw and derives everything via getters.
|
|
39
11
|
*/
|
|
40
12
|
export declare class Chat {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
13
|
+
readonly _raw: {
|
|
14
|
+
id: string;
|
|
15
|
+
name?: string | null;
|
|
16
|
+
archived?: boolean | null;
|
|
17
|
+
pinned?: number | null;
|
|
18
|
+
mute_end_time?: number | null;
|
|
19
|
+
unread_count?: number | null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @internal Documento crudo del chat. `id` es el identificador del engine (JID, LID o
|
|
23
|
+
* `@g.us`); `pinned` y `mute_end_time` son epoch ms.
|
|
24
|
+
* Raw chat document. `id` is the engine identifier (JID, LID or `@g.us`); `pinned` and
|
|
25
|
+
* `mute_end_time` are epoch ms.
|
|
26
|
+
*/
|
|
27
|
+
constructor(_raw: {
|
|
28
|
+
id: string;
|
|
29
|
+
name?: string | null;
|
|
30
|
+
archived?: boolean | null;
|
|
31
|
+
pinned?: number | null;
|
|
32
|
+
mute_end_time?: number | null;
|
|
33
|
+
unread_count?: number | null;
|
|
34
|
+
});
|
|
35
|
+
/** Teléfono del contacto, o el identificador crudo en grupos y LIDs. / Contact phone, or the raw identifier for groups and LIDs. */
|
|
45
36
|
get id(): string;
|
|
46
|
-
/**
|
|
47
|
-
get cid(): string;
|
|
48
|
-
/** Tipo: contact o group. / Type: contact or group. */
|
|
49
|
-
get type(): 'contact' | 'group';
|
|
50
|
-
/** Nombre del chat. / Chat name. */
|
|
37
|
+
/** Nombre del grupo o del contacto. / Group or contact name. */
|
|
51
38
|
get name(): string;
|
|
52
|
-
/**
|
|
53
|
-
get
|
|
54
|
-
/**
|
|
55
|
-
get pinned(): boolean;
|
|
56
|
-
/** Si está archivado. / Whether it's archived. */
|
|
39
|
+
/** Tipo de conversación. / Conversation type. */
|
|
40
|
+
get type(): 'group' | 'contact';
|
|
41
|
+
/** true si el chat está archivado. / true when the chat is archived. */
|
|
57
42
|
get archived(): boolean;
|
|
58
|
-
/** true si el chat está
|
|
59
|
-
get
|
|
60
|
-
/**
|
|
61
|
-
get
|
|
62
|
-
/**
|
|
63
|
-
get
|
|
43
|
+
/** true si el chat está fijado. / true when the chat is pinned. */
|
|
44
|
+
get pinned(): boolean;
|
|
45
|
+
/** Mensajes sin leer del chat. / Chat's unread messages. */
|
|
46
|
+
get count(): number;
|
|
47
|
+
/** Fecha ISO UTC hasta la que el chat está silenciado, o null. / ISO UTC date until the chat stays muted, or null. */
|
|
48
|
+
get muted(): string | null;
|
|
64
49
|
}
|
|
65
50
|
/**
|
|
66
51
|
* Factoría de Chat ligada al contexto WhatsApp.
|
|
@@ -69,184 +54,376 @@ export declare class Chat {
|
|
|
69
54
|
* @param wa - Instancia principal / Main WhatsApp instance
|
|
70
55
|
*/
|
|
71
56
|
export declare function chat(wa: WhatsApp): {
|
|
72
|
-
new (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
pin(value: boolean): Promise<boolean>;
|
|
81
|
-
/** Archiva/desarchiva el chat. / Archives or unarchives the chat. */
|
|
82
|
-
archive(value: boolean): Promise<boolean>;
|
|
83
|
-
/** Silencia/des-silencia el chat. / Mutes or unmutes the chat. */
|
|
84
|
-
mute(value: boolean): Promise<boolean>;
|
|
85
|
-
/** Toggle "Escribiendo...". / Toggles the "typing..." indicator. */
|
|
86
|
-
typing(on: boolean): Promise<boolean>;
|
|
87
|
-
/** Toggle "Grabando audio...". / Toggles the "recording audio..." indicator. */
|
|
88
|
-
recording(on: boolean): Promise<boolean>;
|
|
89
|
-
/** Vacía mensajes del chat (engine local). / Clears chat messages (local engine). */
|
|
90
|
-
clear(): Promise<boolean>;
|
|
91
|
-
/** Elimina el chat y sus mensajes (remoto + local). / Deletes the chat and its messages (remote + local). */
|
|
92
|
-
delete(): Promise<boolean>;
|
|
57
|
+
new (_raw: {
|
|
58
|
+
id: string;
|
|
59
|
+
name?: string | null;
|
|
60
|
+
archived?: boolean | null;
|
|
61
|
+
pinned?: number | null;
|
|
62
|
+
mute_end_time?: number | null;
|
|
63
|
+
unread_count?: number | null;
|
|
64
|
+
}): {
|
|
93
65
|
/**
|
|
94
|
-
* Participantes del chat
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
66
|
+
* Participantes del chat: los integrantes en grupos, el contacto y yo en 1:1.
|
|
67
|
+
* Chat participants: members for groups, the contact and myself for 1:1.
|
|
68
|
+
*
|
|
69
|
+
* @param offset - Desplazamiento / Offset
|
|
70
|
+
* @param limit - Tamaño de página / Page size
|
|
71
|
+
* @returns Página de contactos / Contact page
|
|
100
72
|
*/
|
|
101
73
|
members(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Contact>[]>;
|
|
102
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Descripción del chat: el asunto del grupo o, en un 1:1, la bio del contacto.
|
|
76
|
+
* Es asíncrono porque ninguno de los dos vive en el documento del chat.
|
|
77
|
+
* Chat description: the group's subject or, on a 1:1, the contact's bio. It is async
|
|
78
|
+
* because neither of them lives in the chat document.
|
|
79
|
+
*
|
|
80
|
+
* @returns Descripción, o cadena vacía si no hay / Description, or an empty string when absent
|
|
81
|
+
*/
|
|
82
|
+
content(): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Mensajes del chat paginados desde el más reciente.
|
|
85
|
+
* Chat messages paginated from the most recent one.
|
|
86
|
+
*
|
|
87
|
+
* @param offset - Desplazamiento / Offset
|
|
88
|
+
* @param limit - Tamaño de página / Page size
|
|
89
|
+
* @returns Página de mensajes / Message page
|
|
90
|
+
*/
|
|
103
91
|
messages(offset?: number, limit?: number): Promise<Message[]>;
|
|
104
|
-
/**
|
|
105
|
-
|
|
106
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Activa o desactiva el indicador «escribiendo…».
|
|
94
|
+
* Toggles the "typing…" indicator.
|
|
95
|
+
*
|
|
96
|
+
* @param value - true activa, false vuelve a pausa / true enables, false returns to paused
|
|
97
|
+
* @returns true si el socket estaba disponible / true when the socket was available
|
|
98
|
+
*/
|
|
99
|
+
typing(value: boolean): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* Activa o desactiva el indicador «grabando audio…».
|
|
102
|
+
* Toggles the "recording audio…" indicator.
|
|
103
|
+
*
|
|
104
|
+
* @param value - true activa, false vuelve a pausa / true enables, false returns to paused
|
|
105
|
+
* @returns true si el socket estaba disponible / true when the socket was available
|
|
106
|
+
*/
|
|
107
|
+
recording(value: boolean): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Archiva o desarchiva el chat en la cuenta de WhatsApp.
|
|
110
|
+
* Archives or unarchives the chat on the WhatsApp account.
|
|
111
|
+
*
|
|
112
|
+
* @param value - true archiva, false desarchiva / true archives, false unarchives
|
|
113
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
114
|
+
*/
|
|
115
|
+
archive(value: boolean): Promise<boolean>;
|
|
116
|
+
/**
|
|
117
|
+
* Fija o desfija el chat en la cuenta de WhatsApp. WhatsApp acepta hasta 3 chats
|
|
118
|
+
* fijados y descarta el cuarto sin avisar, así que el límite se verifica antes.
|
|
119
|
+
* Pins or unpins the chat on the WhatsApp account. WhatsApp accepts up to 3 pinned
|
|
120
|
+
* chats and silently drops the fourth, so the limit is checked beforehand.
|
|
121
|
+
*
|
|
122
|
+
* @param value - true fija, false desfija / true pins, false unpins
|
|
123
|
+
* @returns false si el socket está caído o ya hay 3 chats fijados / false when the socket is down or 3 chats are already pinned
|
|
124
|
+
*/
|
|
125
|
+
pin(value: boolean): Promise<boolean>;
|
|
126
|
+
/**
|
|
127
|
+
* Silencia el chat hasta la fecha indicada. `false` o una fecha pasada lo des-silencian.
|
|
128
|
+
* Mutes the chat until the given date. `false` or a past date unmutes it.
|
|
129
|
+
*
|
|
130
|
+
* @param until - Fecha límite (ISO, epoch ms o Date) o false / Deadline (ISO, epoch ms or Date) or false
|
|
131
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
132
|
+
*/
|
|
133
|
+
mute(until: string | number | Date | false): Promise<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* Marca el chat completo como leído en la cuenta de WhatsApp.
|
|
136
|
+
* Marks the whole chat as read on the WhatsApp account.
|
|
137
|
+
*
|
|
138
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
139
|
+
*/
|
|
140
|
+
seen(): Promise<boolean>;
|
|
141
|
+
/**
|
|
142
|
+
* Vacía los mensajes del chat en la cuenta de WhatsApp y en el engine, conservando el chat.
|
|
143
|
+
* Clears the chat messages on the WhatsApp account and in the engine, keeping the chat.
|
|
144
|
+
*
|
|
145
|
+
* @returns true siempre; la limpieza local es idempotente / always true; local cleanup is idempotent
|
|
146
|
+
*/
|
|
147
|
+
clear(): Promise<boolean>;
|
|
148
|
+
/**
|
|
149
|
+
* Elimina el chat y sus mensajes en la cuenta de WhatsApp y en el engine; en grupos
|
|
150
|
+
* abandona el grupo.
|
|
151
|
+
* Deletes the chat and its messages on the WhatsApp account and in the engine; for
|
|
152
|
+
* groups it leaves the group.
|
|
153
|
+
*
|
|
154
|
+
* @returns true siempre; la limpieza local es idempotente / always true; local cleanup is idempotent
|
|
155
|
+
*/
|
|
156
|
+
delete(): Promise<boolean>;
|
|
157
|
+
readonly _raw: {
|
|
158
|
+
id: string;
|
|
159
|
+
name?: string | null;
|
|
160
|
+
archived?: boolean | null;
|
|
161
|
+
pinned?: number | null;
|
|
162
|
+
mute_end_time?: number | null;
|
|
163
|
+
unread_count?: number | null;
|
|
164
|
+
};
|
|
165
|
+
/** Teléfono del contacto, o el identificador crudo en grupos y LIDs. / Contact phone, or the raw identifier for groups and LIDs. */
|
|
107
166
|
get id(): string;
|
|
108
|
-
/**
|
|
109
|
-
get cid(): string;
|
|
110
|
-
/** Tipo: contact o group. / Type: contact or group. */
|
|
111
|
-
get type(): "contact" | "group";
|
|
112
|
-
/** Nombre del chat. / Chat name. */
|
|
167
|
+
/** Nombre del grupo o del contacto. / Group or contact name. */
|
|
113
168
|
get name(): string;
|
|
114
|
-
/**
|
|
115
|
-
get
|
|
116
|
-
/**
|
|
117
|
-
get pinned(): boolean;
|
|
118
|
-
/** Si está archivado. / Whether it's archived. */
|
|
169
|
+
/** Tipo de conversación. / Conversation type. */
|
|
170
|
+
get type(): "group" | "contact";
|
|
171
|
+
/** true si el chat está archivado. / true when the chat is archived. */
|
|
119
172
|
get archived(): boolean;
|
|
120
|
-
/** true si el chat está
|
|
121
|
-
get
|
|
122
|
-
/**
|
|
123
|
-
get
|
|
124
|
-
/**
|
|
125
|
-
get
|
|
173
|
+
/** true si el chat está fijado. / true when the chat is pinned. */
|
|
174
|
+
get pinned(): boolean;
|
|
175
|
+
/** Mensajes sin leer del chat. / Chat's unread messages. */
|
|
176
|
+
get count(): number;
|
|
177
|
+
/** Fecha ISO UTC hasta la que el chat está silenciado, o null. / ISO UTC date until the chat stays muted, or null. */
|
|
178
|
+
get muted(): string | null;
|
|
126
179
|
};
|
|
127
180
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
181
|
+
* Carga un chat por teléfono, JID, LID o id de grupo: el persistido en el engine o,
|
|
182
|
+
* si todavía no existe, una instancia mínima lista para usar (no se persiste).
|
|
183
|
+
* Loads a chat by phone, JID, LID or group id: the engine-persisted one or, when it
|
|
184
|
+
* does not exist yet, a minimal ready-to-use instance (not persisted).
|
|
185
|
+
*
|
|
186
|
+
* @param cid - Teléfono, JID, LID o id de grupo / Phone, JID, LID or group id
|
|
187
|
+
* @returns Chat o null si el identificador es irresoluble / Chat or null when the identifier cannot be resolved
|
|
130
188
|
*/
|
|
131
|
-
get(cid: string): Promise<{
|
|
132
|
-
/** @internal Cache TTL (15s) de la promesa de participants del grupo. Evita round-trips a `groupMetadata` y deduplica llamadas concurrentes. */
|
|
133
|
-
_members_cache: Promise<{
|
|
134
|
-
id: string;
|
|
135
|
-
}[]> | null;
|
|
136
|
-
/** Re-hidrata metadata del chat desde el socket. / Re-hydrates chat metadata from the socket. */
|
|
137
|
-
refresh(): Promise</*elided*/ any | null>;
|
|
138
|
-
/** Fija/desfija el chat. / Pins or unpins the chat. */
|
|
139
|
-
pin(value: boolean): Promise<boolean>;
|
|
140
|
-
/** Archiva/desarchiva el chat. / Archives or unarchives the chat. */
|
|
141
|
-
archive(value: boolean): Promise<boolean>;
|
|
142
|
-
/** Silencia/des-silencia el chat. / Mutes or unmutes the chat. */
|
|
143
|
-
mute(value: boolean): Promise<boolean>;
|
|
144
|
-
/** Toggle "Escribiendo...". / Toggles the "typing..." indicator. */
|
|
145
|
-
typing(on: boolean): Promise<boolean>;
|
|
146
|
-
/** Toggle "Grabando audio...". / Toggles the "recording audio..." indicator. */
|
|
147
|
-
recording(on: boolean): Promise<boolean>;
|
|
148
|
-
/** Vacía mensajes del chat (engine local). / Clears chat messages (local engine). */
|
|
149
|
-
clear(): Promise<boolean>;
|
|
150
|
-
/** Elimina el chat y sus mensajes (remoto + local). / Deletes the chat and its messages (remote + local). */
|
|
151
|
-
delete(): Promise<boolean>;
|
|
189
|
+
get(cid: string | number): Promise<{
|
|
152
190
|
/**
|
|
153
|
-
* Participantes del chat
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
191
|
+
* Participantes del chat: los integrantes en grupos, el contacto y yo en 1:1.
|
|
192
|
+
* Chat participants: members for groups, the contact and myself for 1:1.
|
|
193
|
+
*
|
|
194
|
+
* @param offset - Desplazamiento / Offset
|
|
195
|
+
* @param limit - Tamaño de página / Page size
|
|
196
|
+
* @returns Página de contactos / Contact page
|
|
159
197
|
*/
|
|
160
198
|
members(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Contact>[]>;
|
|
161
|
-
/**
|
|
199
|
+
/**
|
|
200
|
+
* Descripción del chat: el asunto del grupo o, en un 1:1, la bio del contacto.
|
|
201
|
+
* Es asíncrono porque ninguno de los dos vive en el documento del chat.
|
|
202
|
+
* Chat description: the group's subject or, on a 1:1, the contact's bio. It is async
|
|
203
|
+
* because neither of them lives in the chat document.
|
|
204
|
+
*
|
|
205
|
+
* @returns Descripción, o cadena vacía si no hay / Description, or an empty string when absent
|
|
206
|
+
*/
|
|
207
|
+
content(): Promise<string>;
|
|
208
|
+
/**
|
|
209
|
+
* Mensajes del chat paginados desde el más reciente.
|
|
210
|
+
* Chat messages paginated from the most recent one.
|
|
211
|
+
*
|
|
212
|
+
* @param offset - Desplazamiento / Offset
|
|
213
|
+
* @param limit - Tamaño de página / Page size
|
|
214
|
+
* @returns Página de mensajes / Message page
|
|
215
|
+
*/
|
|
162
216
|
messages(offset?: number, limit?: number): Promise<Message[]>;
|
|
163
|
-
/**
|
|
164
|
-
|
|
165
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Activa o desactiva el indicador «escribiendo…».
|
|
219
|
+
* Toggles the "typing…" indicator.
|
|
220
|
+
*
|
|
221
|
+
* @param value - true activa, false vuelve a pausa / true enables, false returns to paused
|
|
222
|
+
* @returns true si el socket estaba disponible / true when the socket was available
|
|
223
|
+
*/
|
|
224
|
+
typing(value: boolean): Promise<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* Activa o desactiva el indicador «grabando audio…».
|
|
227
|
+
* Toggles the "recording audio…" indicator.
|
|
228
|
+
*
|
|
229
|
+
* @param value - true activa, false vuelve a pausa / true enables, false returns to paused
|
|
230
|
+
* @returns true si el socket estaba disponible / true when the socket was available
|
|
231
|
+
*/
|
|
232
|
+
recording(value: boolean): Promise<boolean>;
|
|
233
|
+
/**
|
|
234
|
+
* Archiva o desarchiva el chat en la cuenta de WhatsApp.
|
|
235
|
+
* Archives or unarchives the chat on the WhatsApp account.
|
|
236
|
+
*
|
|
237
|
+
* @param value - true archiva, false desarchiva / true archives, false unarchives
|
|
238
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
239
|
+
*/
|
|
240
|
+
archive(value: boolean): Promise<boolean>;
|
|
241
|
+
/**
|
|
242
|
+
* Fija o desfija el chat en la cuenta de WhatsApp. WhatsApp acepta hasta 3 chats
|
|
243
|
+
* fijados y descarta el cuarto sin avisar, así que el límite se verifica antes.
|
|
244
|
+
* Pins or unpins the chat on the WhatsApp account. WhatsApp accepts up to 3 pinned
|
|
245
|
+
* chats and silently drops the fourth, so the limit is checked beforehand.
|
|
246
|
+
*
|
|
247
|
+
* @param value - true fija, false desfija / true pins, false unpins
|
|
248
|
+
* @returns false si el socket está caído o ya hay 3 chats fijados / false when the socket is down or 3 chats are already pinned
|
|
249
|
+
*/
|
|
250
|
+
pin(value: boolean): Promise<boolean>;
|
|
251
|
+
/**
|
|
252
|
+
* Silencia el chat hasta la fecha indicada. `false` o una fecha pasada lo des-silencian.
|
|
253
|
+
* Mutes the chat until the given date. `false` or a past date unmutes it.
|
|
254
|
+
*
|
|
255
|
+
* @param until - Fecha límite (ISO, epoch ms o Date) o false / Deadline (ISO, epoch ms or Date) or false
|
|
256
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
257
|
+
*/
|
|
258
|
+
mute(until: string | number | Date | false): Promise<boolean>;
|
|
259
|
+
/**
|
|
260
|
+
* Marca el chat completo como leído en la cuenta de WhatsApp.
|
|
261
|
+
* Marks the whole chat as read on the WhatsApp account.
|
|
262
|
+
*
|
|
263
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
264
|
+
*/
|
|
265
|
+
seen(): Promise<boolean>;
|
|
266
|
+
/**
|
|
267
|
+
* Vacía los mensajes del chat en la cuenta de WhatsApp y en el engine, conservando el chat.
|
|
268
|
+
* Clears the chat messages on the WhatsApp account and in the engine, keeping the chat.
|
|
269
|
+
*
|
|
270
|
+
* @returns true siempre; la limpieza local es idempotente / always true; local cleanup is idempotent
|
|
271
|
+
*/
|
|
272
|
+
clear(): Promise<boolean>;
|
|
273
|
+
/**
|
|
274
|
+
* Elimina el chat y sus mensajes en la cuenta de WhatsApp y en el engine; en grupos
|
|
275
|
+
* abandona el grupo.
|
|
276
|
+
* Deletes the chat and its messages on the WhatsApp account and in the engine; for
|
|
277
|
+
* groups it leaves the group.
|
|
278
|
+
*
|
|
279
|
+
* @returns true siempre; la limpieza local es idempotente / always true; local cleanup is idempotent
|
|
280
|
+
*/
|
|
281
|
+
delete(): Promise<boolean>;
|
|
282
|
+
readonly _raw: {
|
|
283
|
+
id: string;
|
|
284
|
+
name?: string | null;
|
|
285
|
+
archived?: boolean | null;
|
|
286
|
+
pinned?: number | null;
|
|
287
|
+
mute_end_time?: number | null;
|
|
288
|
+
unread_count?: number | null;
|
|
289
|
+
};
|
|
290
|
+
/** Teléfono del contacto, o el identificador crudo en grupos y LIDs. / Contact phone, or the raw identifier for groups and LIDs. */
|
|
166
291
|
get id(): string;
|
|
167
|
-
/**
|
|
168
|
-
get cid(): string;
|
|
169
|
-
/** Tipo: contact o group. / Type: contact or group. */
|
|
170
|
-
get type(): "contact" | "group";
|
|
171
|
-
/** Nombre del chat. / Chat name. */
|
|
292
|
+
/** Nombre del grupo o del contacto. / Group or contact name. */
|
|
172
293
|
get name(): string;
|
|
173
|
-
/**
|
|
174
|
-
get
|
|
175
|
-
/**
|
|
176
|
-
get pinned(): boolean;
|
|
177
|
-
/** Si está archivado. / Whether it's archived. */
|
|
294
|
+
/** Tipo de conversación. / Conversation type. */
|
|
295
|
+
get type(): "group" | "contact";
|
|
296
|
+
/** true si el chat está archivado. / true when the chat is archived. */
|
|
178
297
|
get archived(): boolean;
|
|
179
|
-
/** true si el chat está
|
|
180
|
-
get
|
|
181
|
-
/**
|
|
182
|
-
get
|
|
183
|
-
/**
|
|
184
|
-
get
|
|
298
|
+
/** true si el chat está fijado. / true when the chat is pinned. */
|
|
299
|
+
get pinned(): boolean;
|
|
300
|
+
/** Mensajes sin leer del chat. / Chat's unread messages. */
|
|
301
|
+
get count(): number;
|
|
302
|
+
/** Fecha ISO UTC hasta la que el chat está silenciado, o null. / ISO UTC date until the chat stays muted, or null. */
|
|
303
|
+
get muted(): string | null;
|
|
185
304
|
} | null>;
|
|
186
|
-
/**
|
|
305
|
+
/**
|
|
306
|
+
* Pagina los chats persistidos, del más reciente al más antiguo.
|
|
307
|
+
* Paginates persisted chats, from the most recent to the oldest.
|
|
308
|
+
*
|
|
309
|
+
* @param offset - Desplazamiento / Offset
|
|
310
|
+
* @param limit - Tamaño de página / Page size
|
|
311
|
+
* @returns Página de chats / Chat page
|
|
312
|
+
*/
|
|
187
313
|
list(offset?: number, limit?: number): Promise<{
|
|
188
|
-
/** @internal Cache TTL (15s) de la promesa de participants del grupo. Evita round-trips a `groupMetadata` y deduplica llamadas concurrentes. */
|
|
189
|
-
_members_cache: Promise<{
|
|
190
|
-
id: string;
|
|
191
|
-
}[]> | null;
|
|
192
|
-
/** Re-hidrata metadata del chat desde el socket. / Re-hydrates chat metadata from the socket. */
|
|
193
|
-
refresh(): Promise</*elided*/ any | null>;
|
|
194
|
-
/** Fija/desfija el chat. / Pins or unpins the chat. */
|
|
195
|
-
pin(value: boolean): Promise<boolean>;
|
|
196
|
-
/** Archiva/desarchiva el chat. / Archives or unarchives the chat. */
|
|
197
|
-
archive(value: boolean): Promise<boolean>;
|
|
198
|
-
/** Silencia/des-silencia el chat. / Mutes or unmutes the chat. */
|
|
199
|
-
mute(value: boolean): Promise<boolean>;
|
|
200
|
-
/** Toggle "Escribiendo...". / Toggles the "typing..." indicator. */
|
|
201
|
-
typing(on: boolean): Promise<boolean>;
|
|
202
|
-
/** Toggle "Grabando audio...". / Toggles the "recording audio..." indicator. */
|
|
203
|
-
recording(on: boolean): Promise<boolean>;
|
|
204
|
-
/** Vacía mensajes del chat (engine local). / Clears chat messages (local engine). */
|
|
205
|
-
clear(): Promise<boolean>;
|
|
206
|
-
/** Elimina el chat y sus mensajes (remoto + local). / Deletes the chat and its messages (remote + local). */
|
|
207
|
-
delete(): Promise<boolean>;
|
|
208
314
|
/**
|
|
209
|
-
* Participantes del chat
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
315
|
+
* Participantes del chat: los integrantes en grupos, el contacto y yo en 1:1.
|
|
316
|
+
* Chat participants: members for groups, the contact and myself for 1:1.
|
|
317
|
+
*
|
|
318
|
+
* @param offset - Desplazamiento / Offset
|
|
319
|
+
* @param limit - Tamaño de página / Page size
|
|
320
|
+
* @returns Página de contactos / Contact page
|
|
215
321
|
*/
|
|
216
322
|
members(offset?: number, limit?: number): Promise<InstanceType<typeof wa.Contact>[]>;
|
|
217
|
-
/**
|
|
323
|
+
/**
|
|
324
|
+
* Descripción del chat: el asunto del grupo o, en un 1:1, la bio del contacto.
|
|
325
|
+
* Es asíncrono porque ninguno de los dos vive en el documento del chat.
|
|
326
|
+
* Chat description: the group's subject or, on a 1:1, the contact's bio. It is async
|
|
327
|
+
* because neither of them lives in the chat document.
|
|
328
|
+
*
|
|
329
|
+
* @returns Descripción, o cadena vacía si no hay / Description, or an empty string when absent
|
|
330
|
+
*/
|
|
331
|
+
content(): Promise<string>;
|
|
332
|
+
/**
|
|
333
|
+
* Mensajes del chat paginados desde el más reciente.
|
|
334
|
+
* Chat messages paginated from the most recent one.
|
|
335
|
+
*
|
|
336
|
+
* @param offset - Desplazamiento / Offset
|
|
337
|
+
* @param limit - Tamaño de página / Page size
|
|
338
|
+
* @returns Página de mensajes / Message page
|
|
339
|
+
*/
|
|
218
340
|
messages(offset?: number, limit?: number): Promise<Message[]>;
|
|
219
|
-
/**
|
|
220
|
-
|
|
221
|
-
|
|
341
|
+
/**
|
|
342
|
+
* Activa o desactiva el indicador «escribiendo…».
|
|
343
|
+
* Toggles the "typing…" indicator.
|
|
344
|
+
*
|
|
345
|
+
* @param value - true activa, false vuelve a pausa / true enables, false returns to paused
|
|
346
|
+
* @returns true si el socket estaba disponible / true when the socket was available
|
|
347
|
+
*/
|
|
348
|
+
typing(value: boolean): Promise<boolean>;
|
|
349
|
+
/**
|
|
350
|
+
* Activa o desactiva el indicador «grabando audio…».
|
|
351
|
+
* Toggles the "recording audio…" indicator.
|
|
352
|
+
*
|
|
353
|
+
* @param value - true activa, false vuelve a pausa / true enables, false returns to paused
|
|
354
|
+
* @returns true si el socket estaba disponible / true when the socket was available
|
|
355
|
+
*/
|
|
356
|
+
recording(value: boolean): Promise<boolean>;
|
|
357
|
+
/**
|
|
358
|
+
* Archiva o desarchiva el chat en la cuenta de WhatsApp.
|
|
359
|
+
* Archives or unarchives the chat on the WhatsApp account.
|
|
360
|
+
*
|
|
361
|
+
* @param value - true archiva, false desarchiva / true archives, false unarchives
|
|
362
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
363
|
+
*/
|
|
364
|
+
archive(value: boolean): Promise<boolean>;
|
|
365
|
+
/**
|
|
366
|
+
* Fija o desfija el chat en la cuenta de WhatsApp. WhatsApp acepta hasta 3 chats
|
|
367
|
+
* fijados y descarta el cuarto sin avisar, así que el límite se verifica antes.
|
|
368
|
+
* Pins or unpins the chat on the WhatsApp account. WhatsApp accepts up to 3 pinned
|
|
369
|
+
* chats and silently drops the fourth, so the limit is checked beforehand.
|
|
370
|
+
*
|
|
371
|
+
* @param value - true fija, false desfija / true pins, false unpins
|
|
372
|
+
* @returns false si el socket está caído o ya hay 3 chats fijados / false when the socket is down or 3 chats are already pinned
|
|
373
|
+
*/
|
|
374
|
+
pin(value: boolean): Promise<boolean>;
|
|
375
|
+
/**
|
|
376
|
+
* Silencia el chat hasta la fecha indicada. `false` o una fecha pasada lo des-silencian.
|
|
377
|
+
* Mutes the chat until the given date. `false` or a past date unmutes it.
|
|
378
|
+
*
|
|
379
|
+
* @param until - Fecha límite (ISO, epoch ms o Date) o false / Deadline (ISO, epoch ms or Date) or false
|
|
380
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
381
|
+
*/
|
|
382
|
+
mute(until: string | number | Date | false): Promise<boolean>;
|
|
383
|
+
/**
|
|
384
|
+
* Marca el chat completo como leído en la cuenta de WhatsApp.
|
|
385
|
+
* Marks the whole chat as read on the WhatsApp account.
|
|
386
|
+
*
|
|
387
|
+
* @returns true si la acción se envió / true when the action was sent
|
|
388
|
+
*/
|
|
389
|
+
seen(): Promise<boolean>;
|
|
390
|
+
/**
|
|
391
|
+
* Vacía los mensajes del chat en la cuenta de WhatsApp y en el engine, conservando el chat.
|
|
392
|
+
* Clears the chat messages on the WhatsApp account and in the engine, keeping the chat.
|
|
393
|
+
*
|
|
394
|
+
* @returns true siempre; la limpieza local es idempotente / always true; local cleanup is idempotent
|
|
395
|
+
*/
|
|
396
|
+
clear(): Promise<boolean>;
|
|
397
|
+
/**
|
|
398
|
+
* Elimina el chat y sus mensajes en la cuenta de WhatsApp y en el engine; en grupos
|
|
399
|
+
* abandona el grupo.
|
|
400
|
+
* Deletes the chat and its messages on the WhatsApp account and in the engine; for
|
|
401
|
+
* groups it leaves the group.
|
|
402
|
+
*
|
|
403
|
+
* @returns true siempre; la limpieza local es idempotente / always true; local cleanup is idempotent
|
|
404
|
+
*/
|
|
405
|
+
delete(): Promise<boolean>;
|
|
406
|
+
readonly _raw: {
|
|
407
|
+
id: string;
|
|
408
|
+
name?: string | null;
|
|
409
|
+
archived?: boolean | null;
|
|
410
|
+
pinned?: number | null;
|
|
411
|
+
mute_end_time?: number | null;
|
|
412
|
+
unread_count?: number | null;
|
|
413
|
+
};
|
|
414
|
+
/** Teléfono del contacto, o el identificador crudo en grupos y LIDs. / Contact phone, or the raw identifier for groups and LIDs. */
|
|
222
415
|
get id(): string;
|
|
223
|
-
/**
|
|
224
|
-
get cid(): string;
|
|
225
|
-
/** Tipo: contact o group. / Type: contact or group. */
|
|
226
|
-
get type(): "contact" | "group";
|
|
227
|
-
/** Nombre del chat. / Chat name. */
|
|
416
|
+
/** Nombre del grupo o del contacto. / Group or contact name. */
|
|
228
417
|
get name(): string;
|
|
229
|
-
/**
|
|
230
|
-
get
|
|
231
|
-
/**
|
|
232
|
-
get pinned(): boolean;
|
|
233
|
-
/** Si está archivado. / Whether it's archived. */
|
|
418
|
+
/** Tipo de conversación. / Conversation type. */
|
|
419
|
+
get type(): "group" | "contact";
|
|
420
|
+
/** true si el chat está archivado. / true when the chat is archived. */
|
|
234
421
|
get archived(): boolean;
|
|
235
|
-
/** true si el chat está
|
|
236
|
-
get
|
|
237
|
-
/**
|
|
238
|
-
get
|
|
239
|
-
/**
|
|
240
|
-
get
|
|
422
|
+
/** true si el chat está fijado. / true when the chat is pinned. */
|
|
423
|
+
get pinned(): boolean;
|
|
424
|
+
/** Mensajes sin leer del chat. / Chat's unread messages. */
|
|
425
|
+
get count(): number;
|
|
426
|
+
/** Fecha ISO UTC hasta la que el chat está silenciado, o null. / ISO UTC date until the chat stays muted, or null. */
|
|
427
|
+
get muted(): string | null;
|
|
241
428
|
}[]>;
|
|
242
|
-
/** Fija/desfija un chat por CID. / Pins or unpins a chat by CID. */
|
|
243
|
-
pin(cid: string, value: boolean): Promise<boolean>;
|
|
244
|
-
/** Archiva/desarchiva un chat por CID. / Archives or unarchives a chat by CID. */
|
|
245
|
-
archive(cid: string, value: boolean): Promise<boolean>;
|
|
246
|
-
/** Silencia/des-silencia un chat por CID. / Mutes or unmutes a chat by CID. */
|
|
247
|
-
mute(cid: string, value: boolean): Promise<boolean>;
|
|
248
|
-
/** Vacía mensajes del chat (local). / Clears the chat's messages (local only). */
|
|
249
|
-
clear(cid: string): Promise<boolean>;
|
|
250
|
-
/** Elimina el chat y sus mensajes. / Deletes the chat and its messages. */
|
|
251
|
-
delete(cid: string): Promise<boolean>;
|
|
252
429
|
};
|