@arcaelas/whatsapp 1.2.3 → 2.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/build/cjs/Chat.d.ts +317 -0
- package/build/cjs/Chat.js +273 -0
- package/build/cjs/Chat.js.map +1 -0
- package/build/{Contact.d.ts → cjs/Contact.d.ts} +317 -304
- package/build/cjs/Contact.js +144 -0
- package/build/cjs/Contact.js.map +1 -0
- package/build/cjs/Message.d.ts +882 -0
- package/build/cjs/Message.js +483 -0
- package/build/cjs/Message.js.map +1 -0
- package/build/{WhatsApp.d.ts → cjs/WhatsApp.d.ts} +16 -4
- package/build/{WhatsApp.js → cjs/WhatsApp.js} +84 -81
- package/build/cjs/WhatsApp.js.map +1 -0
- package/build/{index.d.ts → cjs/index.d.ts} +2 -2
- package/build/cjs/index.js +17 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/package.json +1 -0
- package/build/cjs/store/driver/FileEngine.d.ts +34 -0
- package/build/{store → cjs/store}/driver/FileEngine.js +16 -20
- package/build/cjs/store/driver/FileEngine.js.map +1 -0
- package/build/{store → cjs/store}/driver/RedisEngine.d.ts +14 -5
- package/build/{store → cjs/store}/driver/RedisEngine.js +23 -22
- package/build/cjs/store/driver/RedisEngine.js.map +1 -0
- package/build/{store → cjs/store}/engine.d.ts +9 -10
- package/build/cjs/store/engine.js.map +1 -0
- package/build/cjs/store/index.d.ts +8 -0
- package/build/{store → cjs/store}/index.js +2 -2
- package/build/cjs/store/index.js.map +1 -0
- package/build/esm/Chat.d.ts +317 -0
- package/build/esm/Chat.js +268 -0
- package/build/esm/Chat.js.map +1 -0
- package/build/esm/Contact.d.ts +869 -0
- package/build/esm/Contact.js +139 -0
- package/build/esm/Contact.js.map +1 -0
- package/build/esm/Message.d.ts +882 -0
- package/build/esm/Message.js +478 -0
- package/build/esm/Message.js.map +1 -0
- package/build/esm/WhatsApp.d.ts +80 -0
- package/build/esm/WhatsApp.js +362 -0
- package/build/esm/WhatsApp.js.map +1 -0
- package/build/esm/index.d.ts +13 -0
- package/build/esm/index.js +10 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/package.json +1 -0
- package/build/esm/store/driver/FileEngine.d.ts +34 -0
- package/build/esm/store/driver/FileEngine.js +82 -0
- package/build/esm/store/driver/FileEngine.js.map +1 -0
- package/build/esm/store/driver/RedisEngine.d.ts +47 -0
- package/build/esm/store/driver/RedisEngine.js +66 -0
- package/build/esm/store/driver/RedisEngine.js.map +1 -0
- package/build/esm/store/engine.d.ts +53 -0
- package/build/esm/store/engine.js +6 -0
- package/build/{store → esm/store}/engine.js.map +1 -1
- package/build/esm/store/index.d.ts +8 -0
- package/build/esm/store/index.js +7 -0
- package/build/esm/store/index.js.map +1 -0
- package/package.json +70 -58
- package/API.md +0 -776
- package/CHANGELOG.md +0 -53
- package/DOC.md +0 -532
- package/build/Chat.d.ts +0 -335
- package/build/Chat.js +0 -396
- package/build/Chat.js.map +0 -1
- package/build/Contact.js +0 -188
- package/build/Contact.js.map +0 -1
- package/build/Message.d.ts +0 -580
- package/build/Message.js +0 -463
- package/build/Message.js.map +0 -1
- package/build/WhatsApp.js.map +0 -1
- package/build/index.js +0 -2
- package/build/index.js.map +0 -7
- package/build/store/driver/FileEngine.d.ts +0 -23
- package/build/store/driver/FileEngine.js.map +0 -1
- package/build/store/driver/RedisEngine.js.map +0 -1
- package/build/store/index.d.ts +0 -8
- package/build/store/index.js.map +0 -1
- package/context7.json +0 -4
- package/tsconfig.json +0 -27
- /package/build/{store → cjs/store}/engine.js +0 -0
|
@@ -0,0 +1,317 @@
|
|
|
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 pined(): boolean;
|
|
68
|
+
/** Si está archivado / Whether it's archived */
|
|
69
|
+
get archived(): boolean;
|
|
70
|
+
/** Timestamp cuando expira el silencio o false / Mute end timestamp or false */
|
|
71
|
+
get muted(): number | false;
|
|
72
|
+
/** Si está leído / Whether it's read */
|
|
73
|
+
get readed(): 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 pined(): boolean;
|
|
141
|
+
/** Si está archivado / Whether it's archived */
|
|
142
|
+
get archived(): boolean;
|
|
143
|
+
/** Timestamp cuando expira el silencio o false / Mute end timestamp or false */
|
|
144
|
+
get muted(): number | false;
|
|
145
|
+
/** Si está leído / Whether it's read */
|
|
146
|
+
get readed(): 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 pined(): boolean;
|
|
212
|
+
/** Si está archivado / Whether it's archived */
|
|
213
|
+
get archived(): boolean;
|
|
214
|
+
/** Timestamp cuando expira el silencio o false / Mute end timestamp or false */
|
|
215
|
+
get muted(): number | false;
|
|
216
|
+
/** Si está leído / Whether it's read */
|
|
217
|
+
get readed(): 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 pined(): boolean;
|
|
283
|
+
/** Si está archivado / Whether it's archived */
|
|
284
|
+
get archived(): boolean;
|
|
285
|
+
/** Timestamp cuando expira el silencio o false / Mute end timestamp or false */
|
|
286
|
+
get muted(): number | false;
|
|
287
|
+
/** Si está leído / Whether it's read */
|
|
288
|
+
get readed(): 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
|
+
};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Chat.ts
|
|
4
|
+
* @description Clase Chat para gestión de conversaciones de WhatsApp
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Chat = void 0;
|
|
8
|
+
exports.chat = chat;
|
|
9
|
+
const baileys_1 = require("baileys");
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* Clase base para representar una conversación de WhatsApp.
|
|
13
|
+
* Base class representing a WhatsApp conversation.
|
|
14
|
+
*/
|
|
15
|
+
class Chat {
|
|
16
|
+
constructor(raw) {
|
|
17
|
+
this.raw = raw;
|
|
18
|
+
}
|
|
19
|
+
/** JID único del chat / Unique chat JID */
|
|
20
|
+
get id() { return this.raw.id; }
|
|
21
|
+
/** Tipo de chat / Chat type */
|
|
22
|
+
get type() { return this.raw.id.endsWith('@g.us') ? 'group' : 'contact'; }
|
|
23
|
+
/** Nombre del chat / Chat name */
|
|
24
|
+
get name() { return this.raw.name ?? this.raw.displayName ?? this.raw.id.split('@')[0]; }
|
|
25
|
+
/** Descripción del chat/grupo / Chat/group description */
|
|
26
|
+
get content() { return this.raw.description ?? ''; }
|
|
27
|
+
/** Si está fijado / Whether it's pinned */
|
|
28
|
+
get pined() { return this.raw.pinned !== null && this.raw.pinned !== undefined; }
|
|
29
|
+
/** Si está archivado / Whether it's archived */
|
|
30
|
+
get archived() { return this.raw.archived ?? false; }
|
|
31
|
+
/** Timestamp cuando expira el silencio o false / Mute end timestamp or false */
|
|
32
|
+
get muted() { return this.raw.muteEndTime ?? false; }
|
|
33
|
+
/** Si está leído / Whether it's read */
|
|
34
|
+
get readed() { return (this.raw.unreadCount === 0 || this.raw.unreadCount === null) && !this.raw.markedAsUnread; }
|
|
35
|
+
/** Si es solo lectura / Whether it's read-only */
|
|
36
|
+
get readonly() { return this.raw.readOnly ?? false; }
|
|
37
|
+
}
|
|
38
|
+
exports.Chat = Chat;
|
|
39
|
+
/**
|
|
40
|
+
* @description Factory que retorna la clase Chat enlazada al contexto.
|
|
41
|
+
* Factory that returns the Chat class bound to context.
|
|
42
|
+
* @param wa Instancia de WhatsApp.
|
|
43
|
+
*/
|
|
44
|
+
function chat(wa) {
|
|
45
|
+
async function _last_messages(cid) {
|
|
46
|
+
const messages_index = await wa.engine.get(`chat/${cid}/messages`);
|
|
47
|
+
if (!messages_index)
|
|
48
|
+
return [];
|
|
49
|
+
const first_line = messages_index.trim().split('\n')[0];
|
|
50
|
+
if (!first_line)
|
|
51
|
+
return [];
|
|
52
|
+
const [timestamp, mid] = first_line.split(' ');
|
|
53
|
+
const msg = await wa.Message.get(cid, mid);
|
|
54
|
+
if (!msg)
|
|
55
|
+
return [];
|
|
56
|
+
return [{ key: { remoteJid: cid, id: msg.id, fromMe: msg.me }, messageTimestamp: Math.floor(Number(timestamp) / 1000) }];
|
|
57
|
+
}
|
|
58
|
+
const _Chat = class extends Chat {
|
|
59
|
+
/**
|
|
60
|
+
* @description Obtiene un chat por su ID.
|
|
61
|
+
* Retrieves a chat by its ID.
|
|
62
|
+
*/
|
|
63
|
+
static async get(cid) {
|
|
64
|
+
const jid = await wa.resolveJID(cid);
|
|
65
|
+
if (!jid)
|
|
66
|
+
return null;
|
|
67
|
+
const stored = await wa.engine.get(`chat/${jid}/index`);
|
|
68
|
+
if (stored)
|
|
69
|
+
return new _Chat(JSON.parse(stored, baileys_1.BufferJSON.reviver));
|
|
70
|
+
const contact = await wa.Contact.get(jid);
|
|
71
|
+
if (!contact)
|
|
72
|
+
return null;
|
|
73
|
+
const raw = { id: jid, name: contact.name };
|
|
74
|
+
await wa.engine.set(`chat/${jid}/index`, JSON.stringify(raw, baileys_1.BufferJSON.replacer));
|
|
75
|
+
return new _Chat(raw);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @description Obtiene chats paginados.
|
|
79
|
+
* Retrieves paginated chats.
|
|
80
|
+
*/
|
|
81
|
+
static async list(offset = 0, limit = 50) {
|
|
82
|
+
const chats = [];
|
|
83
|
+
for (const key of await wa.engine.list('chat/', offset, limit)) {
|
|
84
|
+
const stored = await wa.engine.get(key);
|
|
85
|
+
if (stored)
|
|
86
|
+
chats.push(new _Chat(JSON.parse(stored, baileys_1.BufferJSON.reviver)));
|
|
87
|
+
}
|
|
88
|
+
return chats;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @description Fija o desfija un chat por su ID.
|
|
92
|
+
* Pins or unpins a chat by its ID.
|
|
93
|
+
*/
|
|
94
|
+
static async pin(cid, value) {
|
|
95
|
+
const chat = await _Chat.get(cid);
|
|
96
|
+
return chat ? chat.pin(value) : false;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @description Archiva o desarchiva un chat por su ID.
|
|
100
|
+
* Archives or unarchives a chat by its ID.
|
|
101
|
+
*/
|
|
102
|
+
static async archive(cid, value) {
|
|
103
|
+
const chat = await _Chat.get(cid);
|
|
104
|
+
return chat ? chat.archive(value) : false;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @description Silencia o quita silencio de un chat por su ID.
|
|
108
|
+
* Mutes or unmutes a chat by its ID.
|
|
109
|
+
*/
|
|
110
|
+
static async mute(cid, duration) {
|
|
111
|
+
const chat = await _Chat.get(cid);
|
|
112
|
+
return chat ? chat.mute(duration) : false;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* @description Marca un chat como leido por su ID.
|
|
116
|
+
* Marks a chat as read by its ID.
|
|
117
|
+
*/
|
|
118
|
+
static async seen(cid) {
|
|
119
|
+
const chat = await _Chat.get(cid);
|
|
120
|
+
return chat ? chat.seen() : false;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @description Elimina un chat por su ID.
|
|
124
|
+
* Removes a chat by its ID.
|
|
125
|
+
*/
|
|
126
|
+
static async remove(cid) {
|
|
127
|
+
const chat = await _Chat.get(cid);
|
|
128
|
+
return chat ? chat.remove() : false;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @description Actualiza los datos del chat desde WhatsApp.
|
|
132
|
+
* Refreshes chat data from WhatsApp.
|
|
133
|
+
*/
|
|
134
|
+
async refresh() {
|
|
135
|
+
if (!wa.socket)
|
|
136
|
+
return null;
|
|
137
|
+
if (this.id.endsWith('@g.us')) {
|
|
138
|
+
try {
|
|
139
|
+
const meta = await wa.socket.groupMetadata(this.id);
|
|
140
|
+
this.raw.name = meta.subject;
|
|
141
|
+
this.raw.description = meta.desc ?? null;
|
|
142
|
+
this.raw.participant = meta.participants.map((p) => ({ id: p.id, admin: p.admin ?? null }));
|
|
143
|
+
this.raw.createdBy = meta.owner ?? null;
|
|
144
|
+
this.raw.createdAt = meta.creation ?? null;
|
|
145
|
+
}
|
|
146
|
+
catch { /* group metadata may fail */ }
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
const contact = await wa.Contact.get(this.id);
|
|
150
|
+
if (contact) {
|
|
151
|
+
await contact.refresh();
|
|
152
|
+
this.raw.name = contact.name;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
await wa.engine.set(`chat/${this.id}/index`, JSON.stringify(this.raw, baileys_1.BufferJSON.replacer));
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* @description Elimina el chat con cascade delete.
|
|
160
|
+
* Deletes the chat with cascade delete.
|
|
161
|
+
*/
|
|
162
|
+
async remove() {
|
|
163
|
+
if (!wa.socket)
|
|
164
|
+
return false;
|
|
165
|
+
if (this.type === 'group')
|
|
166
|
+
await wa.socket.groupLeave(this.id);
|
|
167
|
+
else
|
|
168
|
+
await wa.socket.chatModify({ delete: true, lastMessages: [] }, this.id);
|
|
169
|
+
await wa.engine.set(`chat/${this.id}`, null);
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* @description Fija o desfija el chat.
|
|
174
|
+
* Pins or unpins the chat.
|
|
175
|
+
*/
|
|
176
|
+
async pin(value) {
|
|
177
|
+
if (!wa.socket)
|
|
178
|
+
return false;
|
|
179
|
+
const last_messages = await _last_messages(this.id);
|
|
180
|
+
await wa.socket.chatModify({ pin: value, lastMessages: last_messages }, this.id);
|
|
181
|
+
this.raw.pinned = value ? Date.now() : null;
|
|
182
|
+
await wa.engine.set(`chat/${this.id}/index`, JSON.stringify(this.raw, baileys_1.BufferJSON.replacer));
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @description Archiva o desarchiva el chat.
|
|
187
|
+
* Archives or unarchives the chat.
|
|
188
|
+
*/
|
|
189
|
+
async archive(value) {
|
|
190
|
+
if (!wa.socket)
|
|
191
|
+
return false;
|
|
192
|
+
const last_messages = await _last_messages(this.id);
|
|
193
|
+
await wa.socket.chatModify({ archive: value, lastMessages: last_messages }, this.id);
|
|
194
|
+
this.raw.archived = value;
|
|
195
|
+
await wa.engine.set(`chat/${this.id}/index`, JSON.stringify(this.raw, baileys_1.BufferJSON.replacer));
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* @description Silencia o quita silencio del chat.
|
|
200
|
+
* Mutes or unmutes the chat.
|
|
201
|
+
* @param duration Duración en ms (0 o null para quitar silencio) / Duration in ms (0 or null to unmute).
|
|
202
|
+
*/
|
|
203
|
+
async mute(duration) {
|
|
204
|
+
if (!wa.socket)
|
|
205
|
+
return false;
|
|
206
|
+
const mute_end = duration ? Date.now() + duration : null;
|
|
207
|
+
const last_messages = await _last_messages(this.id);
|
|
208
|
+
await wa.socket.chatModify({ mute: mute_end, lastMessages: last_messages }, this.id);
|
|
209
|
+
this.raw.muteEndTime = mute_end;
|
|
210
|
+
await wa.engine.set(`chat/${this.id}/index`, JSON.stringify(this.raw, baileys_1.BufferJSON.replacer));
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @description Marca el chat como leído.
|
|
215
|
+
* Marks the chat as read.
|
|
216
|
+
*/
|
|
217
|
+
async seen() {
|
|
218
|
+
if (!wa.socket)
|
|
219
|
+
return false;
|
|
220
|
+
const last_messages = await _last_messages(this.id);
|
|
221
|
+
if (!last_messages.length)
|
|
222
|
+
return false;
|
|
223
|
+
const msg = last_messages[0];
|
|
224
|
+
const key = msg.key ?? {};
|
|
225
|
+
await wa.socket.readMessages([{ remoteJid: this.id, id: key.id ?? '', participant: key.fromMe ? undefined : key.remoteJid ?? undefined }]);
|
|
226
|
+
this.raw.unreadCount = 0;
|
|
227
|
+
this.raw.markedAsUnread = false;
|
|
228
|
+
await wa.engine.set(`chat/${this.id}/index`, JSON.stringify(this.raw, baileys_1.BufferJSON.replacer));
|
|
229
|
+
return true;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* @description Obtiene los miembros del chat.
|
|
233
|
+
* Gets chat members.
|
|
234
|
+
*/
|
|
235
|
+
async members(offset = 0, limit = 50) {
|
|
236
|
+
if (!this.id.endsWith('@g.us') || !wa.socket) {
|
|
237
|
+
const contact = await wa.Contact.get(this.id);
|
|
238
|
+
return contact ? [contact] : [];
|
|
239
|
+
}
|
|
240
|
+
const members = [];
|
|
241
|
+
for (const p of (await wa.socket.groupMetadata(this.id)).participants.slice(offset, offset + limit)) {
|
|
242
|
+
const existing = await wa.Contact.get(p.id);
|
|
243
|
+
if (existing) {
|
|
244
|
+
members.push(existing);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
const raw = { id: p.id };
|
|
248
|
+
await wa.engine.set(`contact/${p.id}/index`, JSON.stringify(raw, baileys_1.BufferJSON.replacer));
|
|
249
|
+
members.push(new wa.Contact(raw));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return members;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* @description Obtiene mensajes del chat (paginados).
|
|
256
|
+
* Gets chat messages (paginated).
|
|
257
|
+
*/
|
|
258
|
+
async messages(offset = 0, limit = 50) {
|
|
259
|
+
return wa.Message.list(this.id, offset, limit);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* @description Obtiene el contacto asociado al chat (solo chats individuales).
|
|
263
|
+
* Gets the contact associated with the chat (individual chats only).
|
|
264
|
+
*/
|
|
265
|
+
async contact() {
|
|
266
|
+
if (this.type === 'group')
|
|
267
|
+
return null;
|
|
268
|
+
return wa.Contact.get(this.id);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
return _Chat;
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=Chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chat.js","sourceRoot":"","sources":["../../src/Chat.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAoFH,oBAmOC;AArTD,qCAAqC;AAiDrC;;;;GAIG;AACH,MAAa,IAAI;IACb,YAAqB,GAAa;QAAb,QAAG,GAAH,GAAG,CAAU;IAAI,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,EAAE,KAAa,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACxC,+BAA+B;IAC/B,IAAI,IAAI,KAA0B,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/F,kCAAkC;IAClC,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjG,0DAA0D;IAC1D,IAAI,OAAO,KAAa,OAAO,IAAI,CA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