zaileys 0.28.5-dev → 0.28.7-dev

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 CHANGED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 zaadevofc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
1
  <p align="center"><img src="https://socialify.git.ci/zaadevofc/zaileys/image?description=1&amp;descriptionEditable=Zaileys%20is%20a%20simplified%20version%20of%20the%20Baileys%20package%20%0Awhich%20is%20easier%20and%20faster.&amp;font=KoHo&amp;forks=1&amp;issues=1&amp;language=1&amp;name=1&amp;owner=1&amp;pattern=Circuit%20Board&amp;pulls=1&amp;stargazers=1&amp;theme=Auto" alt="project-image"></p>
2
2
 
3
3
  <h1 align="center" id="title">Zaileys - Typescript/Javascript WhatsApp NodeJS API</h1>
4
+
5
+ <h1 align="center" id="title">Not Recommended For Use Because Still Development</h1>
package/dist/index.d.mts CHANGED
@@ -1,29 +1,195 @@
1
1
  import * as baileys from '@whiskeysockets/baileys';
2
2
  import { EventEmitter } from 'events';
3
+ import NodeCache from 'node-cache';
4
+ import BLog from 'beautify-console-log';
3
5
 
4
- type EventName = 'open' | 'message' | 'close' | 'error';
5
- declare class Client extends EventEmitter {
6
- private conn;
6
+ declare class Actions extends EventEmitter {
7
+ private client;
7
8
  private store;
9
+ phoneNumber: number;
10
+ method: 'pairing' | 'qr';
11
+ showLogs: boolean;
12
+ markOnline: boolean;
13
+ autoRead: boolean;
14
+ authors: number[];
15
+ ignoreMe: boolean;
16
+ startLoading: Function;
17
+ stopLoading: Function;
18
+ restart: Function;
19
+ connection(update: baileys.BaileysEventMap['connection.update']): void;
20
+ messages(m: baileys.BaileysEventMap['messages.upsert']): void;
21
+ contactsUpdate(update: baileys.BaileysEventMap['contacts.update']): void;
22
+ contactsUpsert(update: baileys.BaileysEventMap['contacts.upsert']): void;
23
+ groupsUpdate(updates: baileys.BaileysEventMap['groups.update']): void;
24
+ }
25
+
26
+ /**
27
+ * Decode a JID
28
+ * @param jid The JID to decode
29
+ * @returns The decoded JID
30
+ */
31
+ declare const decodeJid: (jid: string) => string;
32
+ /**
33
+ * Serialize a message
34
+ * @param client The Baileys client
35
+ * @param msg The message to serialize
36
+ * @returns The serialized message
37
+ */
38
+ declare function Serialize(client: ReturnType<typeof baileys.default>, config: Client, msg: any): SerializedMessage | undefined;
39
+ interface SerializedMessage {
40
+ roomId: string;
41
+ roomType: RoomType;
42
+ senderId: string;
43
+ senderName: string;
44
+ isMe: boolean;
45
+ isBot: boolean;
46
+ isMedia: boolean;
47
+ isEphemeral: boolean;
48
+ isAuthor: boolean;
49
+ msgType: string;
50
+ msgBody: string;
51
+ msgMentions: string[];
52
+ msgExpiration: number;
53
+ msgTimestamp: number;
54
+ msgMedia?: {
55
+ url: string;
56
+ mimetype: string;
57
+ size: number;
58
+ height: number;
59
+ width: number;
60
+ isAnimated: boolean;
61
+ isAvatar: boolean;
62
+ isAiSticker: boolean;
63
+ isLottie: boolean;
64
+ };
65
+ msgQuoted?: SerializedMessage;
66
+ payload(): baileys.WAProto.IWebMessageInfo;
67
+ key(): baileys.WAProto.IMessageKey;
68
+ }
69
+ type RoomType = 'group' | 'private' | 'channel';
70
+
71
+ interface ClientProps {
72
+ phoneNumber: number;
73
+ method: 'pairing' | 'qr';
74
+ showLogs?: boolean;
75
+ markOnline?: boolean;
76
+ autoRead?: boolean;
77
+ authors?: number[];
78
+ ignoreMe?: boolean;
79
+ }
80
+ declare class Client {
81
+ private client;
82
+ private listeners;
83
+ private pino;
84
+ private authPath;
85
+ private credsPath;
86
+ private storePath;
8
87
  private logger;
88
+ readonly phoneNumber: number;
89
+ readonly method: 'pairing' | 'qr';
90
+ readonly showLogs: boolean;
91
+ readonly markOnline: boolean;
92
+ readonly autoRead: boolean;
93
+ readonly authors: number[];
94
+ readonly ignoreMe: boolean;
95
+ constructor(props: ClientProps);
96
+ initialize(): Promise<void>;
97
+ private pairingCode;
98
+ private handler;
99
+ private emit;
100
+ on(event: string, callback: (data: SerializedMessage) => void): void;
101
+ parseMentions(text: any): any;
102
+ send(data: SerializedMessage, text: any): Promise<SerializedMessage | undefined>;
103
+ reply(data: any, text: any): Promise<SerializedMessage | undefined>;
104
+ edit(data: any, target: any, text: any): Promise<SerializedMessage | undefined>;
105
+ reaction(data: any, emoji: any): Promise<SerializedMessage | undefined>;
106
+ }
107
+
108
+ declare class Logger {
109
+ private bannerLogo;
110
+ private copyright;
9
111
  private spinner;
10
- isRunning: boolean;
11
112
  constructor();
12
- private start;
13
- private restart;
14
- private handleConnection;
15
- private showBanner;
16
- private setupClient;
17
- private setupPairingCode;
18
- private setupProcessHandlers;
19
- private startLoading;
20
- private stopLoading;
21
- private handleMessages;
22
- private handleContactsUpdate;
23
- private handleContactsUpsert;
24
- private handleGroupsUpdate;
25
- sendMessage(jid: string, content: baileys.AnyMessageContent, options?: baileys.MiscMessageGenerationOptions): Promise<baileys.WAProto.WebMessageInfo | undefined>;
26
- on(eventName: EventName, callback: (...args: any[]) => void): this;
113
+ banner(): void;
114
+ msgLogs(data: SerializedMessage): void;
115
+ runSpinner(text: string): void;
116
+ editSpinner(text: string): void;
117
+ stopSpinner(status: ("succeed" | "fail" | "warn" | "info") | undefined, text: string): void;
27
118
  }
28
119
 
29
- export { Client };
120
+ declare const bLog: BLog;
121
+ declare const cLog: {
122
+ (...data: any[]): void;
123
+ (message?: any, ...optionalParams: any[]): void;
124
+ };
125
+ declare const cache: NodeCache;
126
+ declare const logBlock: (status?: "succeed" | "fail" | "warn" | "info") => any;
127
+ declare const sleep: (ms: number) => Promise<unknown>;
128
+
129
+ declare const MESSAGE_TYPE: {
130
+ readonly text: "text";
131
+ readonly conversation: "text";
132
+ readonly imageMessage: "image";
133
+ readonly contactMessage: "contact";
134
+ readonly locationMessage: "location";
135
+ readonly extendedTextMessage: "text";
136
+ readonly documentMessage: "document";
137
+ readonly audioMessage: "audio";
138
+ readonly videoMessage: "video";
139
+ readonly protocolMessage: "protocol";
140
+ readonly contactsArrayMessage: "contactsArray";
141
+ readonly highlyStructuredMessage: "highlyStructured";
142
+ readonly sendPaymentMessage: "sendPayment";
143
+ readonly liveLocationMessage: "liveLocation";
144
+ readonly requestPaymentMessage: "requestPayment";
145
+ readonly declinePaymentRequestMessage: "declinePaymentRequest";
146
+ readonly cancelPaymentRequestMessage: "cancelPaymentRequest";
147
+ readonly templateMessage: "template";
148
+ readonly stickerMessage: "sticker";
149
+ readonly groupInviteMessage: "groupInvite";
150
+ readonly templateButtonReplyMessage: "templateButtonReply";
151
+ readonly productMessage: "product";
152
+ readonly deviceSentMessage: "deviceSent";
153
+ readonly listMessage: "list";
154
+ readonly viewOnceMessage: "viewOnce";
155
+ readonly orderMessage: "order";
156
+ readonly listResponseMessage: "listResponse";
157
+ readonly ephemeralMessage: "ephemeral";
158
+ readonly invoiceMessage: "invoice";
159
+ readonly buttonsMessage: "buttons";
160
+ readonly buttonsResponseMessage: "buttonsResponse";
161
+ readonly paymentInviteMessage: "paymentInvite";
162
+ readonly interactiveMessage: "interactive";
163
+ readonly reactionMessage: "reaction";
164
+ readonly stickerSyncRmrMessage: "sticker";
165
+ readonly interactiveResponseMessage: "interactiveResponse";
166
+ readonly pollCreationMessage: "pollCreation";
167
+ readonly pollUpdateMessage: "pollUpdate";
168
+ readonly keepInChatMessage: "keepInChat";
169
+ readonly documentWithCaptionMessage: "document";
170
+ readonly requestPhoneNumberMessage: "requestPhoneNumber";
171
+ readonly viewOnceMessageV2: "viewOnce";
172
+ readonly encReactionMessage: "reaction";
173
+ readonly editedMessage: "text";
174
+ readonly viewOnceMessageV2Extension: "viewOnce";
175
+ readonly pollCreationMessageV2: "pollCreation";
176
+ readonly scheduledCallCreationMessage: "scheduledCallCreation";
177
+ readonly groupMentionedMessage: "groupMentioned";
178
+ readonly pinInChatMessage: "pinInChat";
179
+ readonly pollCreationMessageV3: "pollCreation";
180
+ readonly scheduledCallEditMessage: "scheduledCallEdit";
181
+ readonly ptvMessage: "ptv";
182
+ readonly botInvokeMessage: "botInvoke";
183
+ readonly callLogMesssage: "callLog";
184
+ readonly encCommentMessage: "encComment";
185
+ readonly bcallMessage: "bcall";
186
+ readonly lottieStickerMessage: "lottieSticker";
187
+ readonly eventMessage: "event";
188
+ readonly commentMessage: "comment";
189
+ readonly newsletterAdminInviteMessage: "text";
190
+ readonly extendedTextMessageWithParentKey: "text";
191
+ readonly placeholderMessage: "placeholder";
192
+ readonly encEventUpdateMessage: "encEventUpdate";
193
+ };
194
+
195
+ export { Actions, Client, Logger, MESSAGE_TYPE, Serialize, type SerializedMessage, bLog, cLog, cache, decodeJid, logBlock, sleep };
package/dist/index.d.ts CHANGED
@@ -1,29 +1,195 @@
1
1
  import * as baileys from '@whiskeysockets/baileys';
2
2
  import { EventEmitter } from 'events';
3
+ import NodeCache from 'node-cache';
4
+ import BLog from 'beautify-console-log';
3
5
 
4
- type EventName = 'open' | 'message' | 'close' | 'error';
5
- declare class Client extends EventEmitter {
6
- private conn;
6
+ declare class Actions extends EventEmitter {
7
+ private client;
7
8
  private store;
9
+ phoneNumber: number;
10
+ method: 'pairing' | 'qr';
11
+ showLogs: boolean;
12
+ markOnline: boolean;
13
+ autoRead: boolean;
14
+ authors: number[];
15
+ ignoreMe: boolean;
16
+ startLoading: Function;
17
+ stopLoading: Function;
18
+ restart: Function;
19
+ connection(update: baileys.BaileysEventMap['connection.update']): void;
20
+ messages(m: baileys.BaileysEventMap['messages.upsert']): void;
21
+ contactsUpdate(update: baileys.BaileysEventMap['contacts.update']): void;
22
+ contactsUpsert(update: baileys.BaileysEventMap['contacts.upsert']): void;
23
+ groupsUpdate(updates: baileys.BaileysEventMap['groups.update']): void;
24
+ }
25
+
26
+ /**
27
+ * Decode a JID
28
+ * @param jid The JID to decode
29
+ * @returns The decoded JID
30
+ */
31
+ declare const decodeJid: (jid: string) => string;
32
+ /**
33
+ * Serialize a message
34
+ * @param client The Baileys client
35
+ * @param msg The message to serialize
36
+ * @returns The serialized message
37
+ */
38
+ declare function Serialize(client: ReturnType<typeof baileys.default>, config: Client, msg: any): SerializedMessage | undefined;
39
+ interface SerializedMessage {
40
+ roomId: string;
41
+ roomType: RoomType;
42
+ senderId: string;
43
+ senderName: string;
44
+ isMe: boolean;
45
+ isBot: boolean;
46
+ isMedia: boolean;
47
+ isEphemeral: boolean;
48
+ isAuthor: boolean;
49
+ msgType: string;
50
+ msgBody: string;
51
+ msgMentions: string[];
52
+ msgExpiration: number;
53
+ msgTimestamp: number;
54
+ msgMedia?: {
55
+ url: string;
56
+ mimetype: string;
57
+ size: number;
58
+ height: number;
59
+ width: number;
60
+ isAnimated: boolean;
61
+ isAvatar: boolean;
62
+ isAiSticker: boolean;
63
+ isLottie: boolean;
64
+ };
65
+ msgQuoted?: SerializedMessage;
66
+ payload(): baileys.WAProto.IWebMessageInfo;
67
+ key(): baileys.WAProto.IMessageKey;
68
+ }
69
+ type RoomType = 'group' | 'private' | 'channel';
70
+
71
+ interface ClientProps {
72
+ phoneNumber: number;
73
+ method: 'pairing' | 'qr';
74
+ showLogs?: boolean;
75
+ markOnline?: boolean;
76
+ autoRead?: boolean;
77
+ authors?: number[];
78
+ ignoreMe?: boolean;
79
+ }
80
+ declare class Client {
81
+ private client;
82
+ private listeners;
83
+ private pino;
84
+ private authPath;
85
+ private credsPath;
86
+ private storePath;
8
87
  private logger;
88
+ readonly phoneNumber: number;
89
+ readonly method: 'pairing' | 'qr';
90
+ readonly showLogs: boolean;
91
+ readonly markOnline: boolean;
92
+ readonly autoRead: boolean;
93
+ readonly authors: number[];
94
+ readonly ignoreMe: boolean;
95
+ constructor(props: ClientProps);
96
+ initialize(): Promise<void>;
97
+ private pairingCode;
98
+ private handler;
99
+ private emit;
100
+ on(event: string, callback: (data: SerializedMessage) => void): void;
101
+ parseMentions(text: any): any;
102
+ send(data: SerializedMessage, text: any): Promise<SerializedMessage | undefined>;
103
+ reply(data: any, text: any): Promise<SerializedMessage | undefined>;
104
+ edit(data: any, target: any, text: any): Promise<SerializedMessage | undefined>;
105
+ reaction(data: any, emoji: any): Promise<SerializedMessage | undefined>;
106
+ }
107
+
108
+ declare class Logger {
109
+ private bannerLogo;
110
+ private copyright;
9
111
  private spinner;
10
- isRunning: boolean;
11
112
  constructor();
12
- private start;
13
- private restart;
14
- private handleConnection;
15
- private showBanner;
16
- private setupClient;
17
- private setupPairingCode;
18
- private setupProcessHandlers;
19
- private startLoading;
20
- private stopLoading;
21
- private handleMessages;
22
- private handleContactsUpdate;
23
- private handleContactsUpsert;
24
- private handleGroupsUpdate;
25
- sendMessage(jid: string, content: baileys.AnyMessageContent, options?: baileys.MiscMessageGenerationOptions): Promise<baileys.WAProto.WebMessageInfo | undefined>;
26
- on(eventName: EventName, callback: (...args: any[]) => void): this;
113
+ banner(): void;
114
+ msgLogs(data: SerializedMessage): void;
115
+ runSpinner(text: string): void;
116
+ editSpinner(text: string): void;
117
+ stopSpinner(status: ("succeed" | "fail" | "warn" | "info") | undefined, text: string): void;
27
118
  }
28
119
 
29
- export { Client };
120
+ declare const bLog: BLog;
121
+ declare const cLog: {
122
+ (...data: any[]): void;
123
+ (message?: any, ...optionalParams: any[]): void;
124
+ };
125
+ declare const cache: NodeCache;
126
+ declare const logBlock: (status?: "succeed" | "fail" | "warn" | "info") => any;
127
+ declare const sleep: (ms: number) => Promise<unknown>;
128
+
129
+ declare const MESSAGE_TYPE: {
130
+ readonly text: "text";
131
+ readonly conversation: "text";
132
+ readonly imageMessage: "image";
133
+ readonly contactMessage: "contact";
134
+ readonly locationMessage: "location";
135
+ readonly extendedTextMessage: "text";
136
+ readonly documentMessage: "document";
137
+ readonly audioMessage: "audio";
138
+ readonly videoMessage: "video";
139
+ readonly protocolMessage: "protocol";
140
+ readonly contactsArrayMessage: "contactsArray";
141
+ readonly highlyStructuredMessage: "highlyStructured";
142
+ readonly sendPaymentMessage: "sendPayment";
143
+ readonly liveLocationMessage: "liveLocation";
144
+ readonly requestPaymentMessage: "requestPayment";
145
+ readonly declinePaymentRequestMessage: "declinePaymentRequest";
146
+ readonly cancelPaymentRequestMessage: "cancelPaymentRequest";
147
+ readonly templateMessage: "template";
148
+ readonly stickerMessage: "sticker";
149
+ readonly groupInviteMessage: "groupInvite";
150
+ readonly templateButtonReplyMessage: "templateButtonReply";
151
+ readonly productMessage: "product";
152
+ readonly deviceSentMessage: "deviceSent";
153
+ readonly listMessage: "list";
154
+ readonly viewOnceMessage: "viewOnce";
155
+ readonly orderMessage: "order";
156
+ readonly listResponseMessage: "listResponse";
157
+ readonly ephemeralMessage: "ephemeral";
158
+ readonly invoiceMessage: "invoice";
159
+ readonly buttonsMessage: "buttons";
160
+ readonly buttonsResponseMessage: "buttonsResponse";
161
+ readonly paymentInviteMessage: "paymentInvite";
162
+ readonly interactiveMessage: "interactive";
163
+ readonly reactionMessage: "reaction";
164
+ readonly stickerSyncRmrMessage: "sticker";
165
+ readonly interactiveResponseMessage: "interactiveResponse";
166
+ readonly pollCreationMessage: "pollCreation";
167
+ readonly pollUpdateMessage: "pollUpdate";
168
+ readonly keepInChatMessage: "keepInChat";
169
+ readonly documentWithCaptionMessage: "document";
170
+ readonly requestPhoneNumberMessage: "requestPhoneNumber";
171
+ readonly viewOnceMessageV2: "viewOnce";
172
+ readonly encReactionMessage: "reaction";
173
+ readonly editedMessage: "text";
174
+ readonly viewOnceMessageV2Extension: "viewOnce";
175
+ readonly pollCreationMessageV2: "pollCreation";
176
+ readonly scheduledCallCreationMessage: "scheduledCallCreation";
177
+ readonly groupMentionedMessage: "groupMentioned";
178
+ readonly pinInChatMessage: "pinInChat";
179
+ readonly pollCreationMessageV3: "pollCreation";
180
+ readonly scheduledCallEditMessage: "scheduledCallEdit";
181
+ readonly ptvMessage: "ptv";
182
+ readonly botInvokeMessage: "botInvoke";
183
+ readonly callLogMesssage: "callLog";
184
+ readonly encCommentMessage: "encComment";
185
+ readonly bcallMessage: "bcall";
186
+ readonly lottieStickerMessage: "lottieSticker";
187
+ readonly eventMessage: "event";
188
+ readonly commentMessage: "comment";
189
+ readonly newsletterAdminInviteMessage: "text";
190
+ readonly extendedTextMessageWithParentKey: "text";
191
+ readonly placeholderMessage: "placeholder";
192
+ readonly encEventUpdateMessage: "encEventUpdate";
193
+ };
194
+
195
+ export { Actions, Client, Logger, MESSAGE_TYPE, Serialize, type SerializedMessage, bLog, cLog, cache, decodeJid, logBlock, sleep };