@zetagoaurum-socket/wasocket 2.2.2 → 3.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/LICENSE +1 -1
- package/README.md +84 -67
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +3344 -0
- package/WAProto/index.d.ts +37016 -0
- package/WAProto/index.js +79296 -118676
- package/WASignalGroup/GroupProtocol.js +1697 -0
- package/WASignalGroup/ciphertext_message.js +16 -0
- package/WASignalGroup/group_cipher.js +120 -0
- package/WASignalGroup/group_session_builder.js +46 -0
- package/WASignalGroup/index.js +5 -0
- package/WASignalGroup/keyhelper.js +21 -0
- package/WASignalGroup/protobufs.js +3 -0
- package/WASignalGroup/queue_job.js +69 -0
- package/WASignalGroup/sender_chain_key.js +50 -0
- package/WASignalGroup/sender_key_distribution_message.js +78 -0
- package/WASignalGroup/sender_key_message.js +92 -0
- package/WASignalGroup/sender_key_name.js +70 -0
- package/WASignalGroup/sender_key_record.js +56 -0
- package/WASignalGroup/sender_key_state.js +129 -0
- package/{lib/Signal/Group/sender-message-key.js → WASignalGroup/sender_message_key.js} +16 -6
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +9 -50
- package/lib/Signal/libsignal.js +29 -51
- package/lib/Socket/business.d.ts +2 -3
- package/lib/Socket/chats.d.ts +28 -215
- package/lib/Socket/chats.js +70 -185
- package/lib/Socket/dugong.js +141 -432
- package/lib/Socket/groups.js +23 -20
- package/lib/Socket/index.js +15 -2
- package/lib/Socket/messages-recv.d.ts +55 -56
- package/lib/Socket/messages-recv.js +112 -370
- package/lib/Socket/messages-send.d.ts +2 -3
- package/lib/Socket/messages-send.js +368 -465
- package/lib/Socket/newsletter.js +28 -175
- package/lib/Socket/socket.js +174 -203
- package/lib/Socket/usync.d.ts +3 -3
- package/lib/Types/GroupMetadata.d.ts +0 -1
- package/lib/Types/Newsletter.d.ts +86 -97
- package/lib/Types/Newsletter.js +32 -38
- package/lib/Utils/chat-utils.js +3 -17
- package/lib/Utils/generics.js +31 -68
- package/lib/Utils/history.js +1 -6
- package/lib/Utils/link-preview.js +2 -4
- package/lib/Utils/messages-media.js +57 -145
- package/lib/Utils/messages.js +305 -89
- package/lib/Utils/signal.js +46 -48
- package/lib/Utils/use-multi-file-auth-state.js +6 -45
- package/lib/Utils/validate-connection.js +65 -91
- package/lib/WABinary/constants.d.ts +24 -27
- package/lib/WABinary/encode.js +123 -160
- package/lib/WABinary/generic-utils.d.ts +0 -2
- package/lib/WABinary/generic-utils.js +36 -124
- package/lib/WABinary/jid-utils.js +26 -5
- package/lib/WAUSync/Fall +1 -0
- package/lib/WAUSync/Protocols/Fal +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -9
- package/package.json +100 -105
- package/engine-requirements.js +0 -10
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
- package/lib/Signal/Group/ciphertext-message.js +0 -15
- package/lib/Signal/Group/group-session-builder.d.ts +0 -14
- package/lib/Signal/Group/group-session-builder.js +0 -64
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/group_cipher.js +0 -96
- package/lib/Signal/Group/index.d.ts +0 -11
- package/lib/Signal/Group/index.js +0 -57
- package/lib/Signal/Group/keyhelper.d.ts +0 -10
- package/lib/Signal/Group/keyhelper.js +0 -55
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/queue-job.js +0 -57
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
- package/lib/Signal/Group/sender-chain-key.js +0 -34
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
- package/lib/Signal/Group/sender-key-distribution-message.js +0 -66
- package/lib/Signal/Group/sender-key-message.d.ts +0 -18
- package/lib/Signal/Group/sender-key-message.js +0 -69
- package/lib/Signal/Group/sender-key-name.d.ts +0 -17
- package/lib/Signal/Group/sender-key-name.js +0 -51
- package/lib/Signal/Group/sender-key-record.d.ts +0 -30
- package/lib/Signal/Group/sender-key-record.js +0 -53
- package/lib/Signal/Group/sender-key-state.d.ts +0 -38
- package/lib/Signal/Group/sender-key-state.js +0 -99
- package/lib/Signal/Group/sender-message-key.d.ts +0 -11
- package/lib/Socket/chats.js.bak +0 -981
- package/lib/Socket/dugong.d.ts +0 -254
- package/lib/Types/USync.d.ts +0 -25
- package/lib/Types/USync.js +0 -2
- package/lib/Utils/anti-crash.js +0 -20
- package/lib/Utils/auto-contact.js +0 -74
- package/lib/Utils/generics.js.bak +0 -433
- package/lib/Utils/validate-connection.js.bak +0 -237
package/lib/Socket/dugong.d.ts
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
// dugong.d.ts
|
|
2
|
-
import { proto } from '../../WAProto';
|
|
3
|
-
|
|
4
|
-
declare namespace kikyy {
|
|
5
|
-
interface MediaUploadOptions {
|
|
6
|
-
fileEncSha256?: Buffer;
|
|
7
|
-
mediaType?: string;
|
|
8
|
-
newsletter?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type WAMediaUploadFunction = (
|
|
12
|
-
stream: Buffer | NodeJS.ReadableStream,
|
|
13
|
-
options?: MediaUploadOptions
|
|
14
|
-
) => Promise<{ url: string; directPath: string }>;
|
|
15
|
-
|
|
16
|
-
interface WAMessageContentGenerationOptions {
|
|
17
|
-
upload?: WAMediaUploadFunction;
|
|
18
|
-
mediaCache?: any;
|
|
19
|
-
options?: any;
|
|
20
|
-
logger?: any;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface StickerMessage {
|
|
24
|
-
url: string;
|
|
25
|
-
fileSha256: Buffer | string;
|
|
26
|
-
fileEncSha256: Buffer | string;
|
|
27
|
-
mediaKey: Buffer | string;
|
|
28
|
-
mimetype: string;
|
|
29
|
-
directPath: string;
|
|
30
|
-
fileLength: number | string;
|
|
31
|
-
mediaKeyTimestamp: number | string;
|
|
32
|
-
isAnimated?: boolean;
|
|
33
|
-
stickerSentTs?: number | string;
|
|
34
|
-
isAvatar?: boolean;
|
|
35
|
-
isAiSticker?: boolean;
|
|
36
|
-
isLottie?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface PaymentMessage {
|
|
40
|
-
amount: number;
|
|
41
|
-
currency?: string;
|
|
42
|
-
from?: string;
|
|
43
|
-
expiry?: number;
|
|
44
|
-
sticker?: { stickerMessage: StickerMessage };
|
|
45
|
-
note?: string;
|
|
46
|
-
background?: {
|
|
47
|
-
id?: string;
|
|
48
|
-
fileLength?: string;
|
|
49
|
-
width?: number;
|
|
50
|
-
height?: number;
|
|
51
|
-
mimetype?: string;
|
|
52
|
-
placeholderArgb?: number;
|
|
53
|
-
textArgb?: number;
|
|
54
|
-
subtextArgb?: number;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface ProductMessage {
|
|
59
|
-
title: string;
|
|
60
|
-
description: string;
|
|
61
|
-
thumbnail: Buffer | { url: string };
|
|
62
|
-
productId: string;
|
|
63
|
-
retailerId: string;
|
|
64
|
-
url: string;
|
|
65
|
-
body?: string;
|
|
66
|
-
footer?: string;
|
|
67
|
-
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
68
|
-
priceAmount1000?: number | null;
|
|
69
|
-
currencyCode?: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
interface InteractiveMessage {
|
|
73
|
-
header?: string;
|
|
74
|
-
title: string;
|
|
75
|
-
footer?: string;
|
|
76
|
-
thumbnail?: string;
|
|
77
|
-
image?: string | Buffer | { url: string };
|
|
78
|
-
video?: string | Buffer | { url: string };
|
|
79
|
-
document?: string | Buffer | { url: string };
|
|
80
|
-
mimetype?: string;
|
|
81
|
-
fileName?: string;
|
|
82
|
-
jpegThumbnail?: string | Buffer | { url: string };
|
|
83
|
-
contextInfo?: {
|
|
84
|
-
mentionedJid?: string[];
|
|
85
|
-
forwardingScore?: number;
|
|
86
|
-
isForwarded?: boolean;
|
|
87
|
-
externalAdReply?: {
|
|
88
|
-
title?: string;
|
|
89
|
-
body?: string;
|
|
90
|
-
mediaType?: number;
|
|
91
|
-
thumbnailUrl?: string;
|
|
92
|
-
mediaUrl?: string;
|
|
93
|
-
sourceUrl?: string;
|
|
94
|
-
showAdAttribution?: boolean;
|
|
95
|
-
renderLargerThumbnail?: boolean;
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
};
|
|
98
|
-
[key: string]: any;
|
|
99
|
-
};
|
|
100
|
-
externalAdReply?: {
|
|
101
|
-
title?: string;
|
|
102
|
-
body?: string;
|
|
103
|
-
mediaType?: number;
|
|
104
|
-
thumbnailUrl?: string;
|
|
105
|
-
mediaUrl?: string;
|
|
106
|
-
sourceUrl?: string;
|
|
107
|
-
showAdAttribution?: boolean;
|
|
108
|
-
renderLargerThumbnail?: boolean;
|
|
109
|
-
[key: string]: any;
|
|
110
|
-
};
|
|
111
|
-
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
112
|
-
nativeFlowMessage?: {
|
|
113
|
-
messageParamsJson?: string;
|
|
114
|
-
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
115
|
-
[key: string]: any;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
interface AlbumItem {
|
|
120
|
-
image?: string | Buffer | { url: string; caption?: string };
|
|
121
|
-
video?: string | Buffer | { url: string; caption?: string };
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface EventMessageLocation {
|
|
125
|
-
degreesLatitude: number;
|
|
126
|
-
degreesLongitude: number;
|
|
127
|
-
name: string;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
interface EventMessage {
|
|
131
|
-
isCanceled?: boolean;
|
|
132
|
-
name: string;
|
|
133
|
-
description: string;
|
|
134
|
-
location?: EventMessageLocation;
|
|
135
|
-
joinLink?: string;
|
|
136
|
-
startTime?: string | number;
|
|
137
|
-
endTime?: string | number;
|
|
138
|
-
extraGuestsAllowed?: boolean;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
interface PollVote {
|
|
142
|
-
optionName: string;
|
|
143
|
-
optionVoteCount: string | number;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
interface PollResultMessage {
|
|
147
|
-
name: string;
|
|
148
|
-
pollVotes: PollVote[];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
interface GroupStatusMessage {
|
|
152
|
-
message?: any;
|
|
153
|
-
image?: string | Buffer | { url: string };
|
|
154
|
-
video?: string | Buffer | { url: string };
|
|
155
|
-
text?: string;
|
|
156
|
-
caption?: string;
|
|
157
|
-
document?: string | Buffer | { url: string };
|
|
158
|
-
[key: string]: any;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
interface MessageContent {
|
|
162
|
-
requestPaymentMessage?: PaymentMessage;
|
|
163
|
-
productMessage?: ProductMessage;
|
|
164
|
-
interactiveMessage?: InteractiveMessage;
|
|
165
|
-
albumMessage?: AlbumItem[];
|
|
166
|
-
eventMessage?: EventMessage;
|
|
167
|
-
pollResultMessage?: PollResultMessage;
|
|
168
|
-
groupStatusMessage?: GroupStatusMessage;
|
|
169
|
-
sender?: string;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
interface MessageOptions {
|
|
173
|
-
quoted?: proto.IWebMessageInfo;
|
|
174
|
-
filter?: boolean;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
interface Utils {
|
|
178
|
-
prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
179
|
-
generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
180
|
-
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
181
|
-
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
182
|
-
generateMessageID: () => string;
|
|
183
|
-
prepareMessageContent?: (content: any, options?: any) => Promise<any>;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
interface BailUtils {
|
|
187
|
-
generateWAMessageContent?: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
188
|
-
generateMessageID: () => string;
|
|
189
|
-
getContentType: (msg: any) => string;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
declare class kikyy {
|
|
194
|
-
constructor(
|
|
195
|
-
utils: kikyy.Utils,
|
|
196
|
-
waUploadToServer: kikyy.WAMediaUploadFunction,
|
|
197
|
-
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
detectType(content: kikyy.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
|
|
201
|
-
|
|
202
|
-
handlePayment(
|
|
203
|
-
content: { requestPaymentMessage: kikyy.PaymentMessage },
|
|
204
|
-
quoted?: proto.IWebMessageInfo
|
|
205
|
-
): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
|
|
206
|
-
|
|
207
|
-
handleProduct(
|
|
208
|
-
content: { productMessage: kikyy.ProductMessage },
|
|
209
|
-
jid: string,
|
|
210
|
-
quoted?: proto.IWebMessageInfo
|
|
211
|
-
): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
|
|
212
|
-
|
|
213
|
-
handleInteractive(
|
|
214
|
-
content: { interactiveMessage: kikyy.InteractiveMessage },
|
|
215
|
-
jid: string,
|
|
216
|
-
quoted?: proto.IWebMessageInfo
|
|
217
|
-
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
218
|
-
|
|
219
|
-
handleAlbum(
|
|
220
|
-
content: { albumMessage: kikyy.AlbumItem[] },
|
|
221
|
-
jid: string,
|
|
222
|
-
quoted?: proto.IWebMessageInfo
|
|
223
|
-
): Promise<any>;
|
|
224
|
-
|
|
225
|
-
handleEvent(
|
|
226
|
-
content: { eventMessage: kikyy.EventMessage },
|
|
227
|
-
jid: string,
|
|
228
|
-
quoted?: proto.IWebMessageInfo
|
|
229
|
-
): Promise<any>;
|
|
230
|
-
|
|
231
|
-
handlePollResult(
|
|
232
|
-
content: { pollResultMessage: kikyy.PollResultMessage },
|
|
233
|
-
jid: string,
|
|
234
|
-
quoted?: proto.IWebMessageInfo
|
|
235
|
-
): Promise<any>;
|
|
236
|
-
|
|
237
|
-
handleGroupStory(
|
|
238
|
-
content: { groupStatusMessage: kikyy.GroupStatusMessage },
|
|
239
|
-
jid: string,
|
|
240
|
-
quoted?: proto.IWebMessageInfo
|
|
241
|
-
): Promise<any>;
|
|
242
|
-
|
|
243
|
-
buildMessageContent(
|
|
244
|
-
content: any,
|
|
245
|
-
opts?: kikyy.WAMessageContentGenerationOptions
|
|
246
|
-
): Promise<any>;
|
|
247
|
-
|
|
248
|
-
utils: kikyy.Utils;
|
|
249
|
-
relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
250
|
-
waUploadToServer: kikyy.WAMediaUploadFunction;
|
|
251
|
-
bail: kikyy.BailUtils;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export = kikyy;
|
package/lib/Types/USync.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BinaryNode } from '../WABinary';
|
|
2
|
-
import { USyncUser } from '../WAUSync';
|
|
3
|
-
/**
|
|
4
|
-
* Defines the interface for a USyncQuery protocol
|
|
5
|
-
*/
|
|
6
|
-
export interface USyncQueryProtocol {
|
|
7
|
-
/**
|
|
8
|
-
* The name of the protocol
|
|
9
|
-
*/
|
|
10
|
-
name: string;
|
|
11
|
-
/**
|
|
12
|
-
* Defines what goes inside the query part of a USyncQuery
|
|
13
|
-
*/
|
|
14
|
-
getQueryElement: () => BinaryNode;
|
|
15
|
-
/**
|
|
16
|
-
* Defines what goes inside the user part of a USyncQuery
|
|
17
|
-
*/
|
|
18
|
-
getUserElement: (user: USyncUser) => BinaryNode | null;
|
|
19
|
-
/**
|
|
20
|
-
* Parse the result of the query
|
|
21
|
-
* @param data Data from the result
|
|
22
|
-
* @returns Whatever the protocol is supposed to return
|
|
23
|
-
*/
|
|
24
|
-
parser: (data: BinaryNode) => unknown;
|
|
25
|
-
}
|
package/lib/Types/USync.js
DELETED
package/lib/Utils/anti-crash.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module.exports = () => {
|
|
2
|
-
const logger = require('./logger').default.child({ class: 'anti-crash' });
|
|
3
|
-
|
|
4
|
-
const chalk = require('chalk');
|
|
5
|
-
|
|
6
|
-
process.on('uncaughtException', (err) => {
|
|
7
|
-
console.log(chalk.red.bold('[\u274c ANTI-KILL] Uncaught Exception Detected!'));
|
|
8
|
-
console.log(chalk.yellow(`Reason: ${err.message}`));
|
|
9
|
-
console.log(chalk.gray(err.stack));
|
|
10
|
-
// Prevent exit
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
14
|
-
console.log(chalk.red.bold('[\u274c ANTI-KILL] Unhandled Rejection!'));
|
|
15
|
-
console.log(chalk.yellow(`Reason: ${reason}`));
|
|
16
|
-
// Prevent exit
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
console.log(chalk.cyan.bold('[ANTI-KILL] Protection Active \u2705'));
|
|
20
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContactManager = void 0;
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const CONTACT_FILE = path.join(process.cwd(), 'user_contact.json');
|
|
7
|
-
const COUNTER_FILE = path.join(process.cwd(), 'counter.json');
|
|
8
|
-
class ContactManager {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.cache = new Set();
|
|
11
|
-
this.counter = 1;
|
|
12
|
-
this.contacts = {};
|
|
13
|
-
this.init();
|
|
14
|
-
}
|
|
15
|
-
init() {
|
|
16
|
-
if (!fs.existsSync(CONTACT_FILE)) {
|
|
17
|
-
fs.writeFileSync(CONTACT_FILE, JSON.stringify({}, null, 2));
|
|
18
|
-
}
|
|
19
|
-
if (!fs.existsSync(COUNTER_FILE)) {
|
|
20
|
-
fs.writeFileSync(COUNTER_FILE, JSON.stringify({ count: 1 }, null, 2));
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
this.contacts = JSON.parse(fs.readFileSync(CONTACT_FILE, 'utf-8'));
|
|
24
|
-
const counterData = JSON.parse(fs.readFileSync(COUNTER_FILE, 'utf-8'));
|
|
25
|
-
this.counter = counterData.count || 1;
|
|
26
|
-
Object.keys(this.contacts).forEach(jid => this.cache.add(jid));
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.error('[ContactManager] Error loading data:', error);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
_save() {
|
|
33
|
-
try {
|
|
34
|
-
fs.writeFileSync(CONTACT_FILE, JSON.stringify(this.contacts, null, 2));
|
|
35
|
-
fs.writeFileSync(COUNTER_FILE, JSON.stringify({ count: this.counter }, null, 2));
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error('[ContactManager] Error saving data:', error);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
checkAndSave(jid, sock) {
|
|
42
|
-
if (!jid || jid.includes('@g.us') || jid === 'status@broadcast')
|
|
43
|
-
return;
|
|
44
|
-
const normalizedJid = jid.split('@')[0] + '@s.whatsapp.net';
|
|
45
|
-
|
|
46
|
-
// Skip if already in cache
|
|
47
|
-
if (this.cache.has(normalizedJid)) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Logic to skip owner and bot number (assuming they are in contacts or injected config)
|
|
52
|
-
// For now, we just rely on the existence check.
|
|
53
|
-
// If sock is provided, we can also check if it's the bot's own ID
|
|
54
|
-
if (sock && sock.user && sock.user.id) {
|
|
55
|
-
const botId = sock.user.id.split(':')[0] + '@s.whatsapp.net';
|
|
56
|
-
if (normalizedJid === botId) return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const codename = `ZetaGo-user${this.counter}`;
|
|
60
|
-
this.contacts[normalizedJid] = {
|
|
61
|
-
id: normalizedJid,
|
|
62
|
-
name: codename,
|
|
63
|
-
savedAt: new Date().toISOString()
|
|
64
|
-
};
|
|
65
|
-
this.cache.add(normalizedJid);
|
|
66
|
-
this.counter++;
|
|
67
|
-
this._save();
|
|
68
|
-
console.log(`[AutoSafe] Saved new contact: ${normalizedJid} as ${codename}`);
|
|
69
|
-
|
|
70
|
-
// Optional: If we had access to full sock here, we could try to push a sync
|
|
71
|
-
// But the requirement is mainly about the internal list and counter.
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.ContactManager = new ContactManager();
|