zaileys 1.1.31 → 1.1.32

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/dist/index.d.mts CHANGED
@@ -2137,149 +2137,23 @@ declare class Worker {
2137
2137
  mute(mute: z.infer<typeof MuteWorkerBaseType>, options: z.infer<typeof MuteWorkerOptionsType>): Promise<void | undefined>;
2138
2138
  profile(roomId: z.infer<typeof ProfileWorkerBaseType>): Promise<z.infer<typeof ProfileWorkerBaseOutputType> | null>;
2139
2139
  presence(action: z.infer<typeof PresenceWorkerBaseType>, options: z.infer<typeof PresenceWorkerOptionsType>): Promise<void | undefined>;
2140
- addCompletion(props: z.infer<typeof llmMessagesTable>): Promise<{
2141
- channelId: string;
2142
- uniqueId: string;
2143
- role: string;
2144
- content: string;
2145
- model?: string | null | undefined;
2146
- additional?: string | null | undefined;
2147
- }>;
2148
- deleteCompletion(uniqueId: string): Promise<boolean>;
2149
- updateCompletion(uniqueId: string, props: Partial<z.infer<typeof llmMessagesTable>>): Promise<{
2150
- channelId: string;
2151
- uniqueId: string;
2152
- role: string;
2153
- content: string;
2154
- model?: string | null | undefined;
2155
- additional?: string | null | undefined;
2156
- }>;
2157
- clearCompletions(channelId: string): Promise<boolean>;
2158
- getCompletion(uniqueId: string): Promise<{
2159
- channelId: string;
2160
- uniqueId: string;
2161
- role: string;
2162
- content: string;
2163
- model?: string | null | undefined;
2164
- additional?: string | null | undefined;
2165
- } | null>;
2166
- getCompletions(channelId: string): Promise<{
2167
- channelId: string;
2168
- uniqueId: string;
2169
- role: string;
2170
- content: string;
2171
- model?: string | null | undefined;
2172
- additional?: string | null | undefined;
2173
- }[]>;
2174
- addPersonalization(props: z.infer<typeof llmPersonalizationTable>): Promise<{
2175
- uniqueId: string;
2176
- content: string;
2177
- senderId: string;
2178
- }>;
2179
- deletePersonalization(uniqueId: string): Promise<boolean>;
2180
- clearPersonalization(senderId: string): Promise<boolean>;
2181
- getPersonalization(senderId: string): Promise<{
2182
- uniqueId: string;
2183
- content: string;
2184
- senderId: string;
2185
- }[]>;
2186
- addRAG(props: z.infer<typeof addRAGType>): Promise<any>;
2187
- deleteRAG(id: string): Promise<boolean>;
2188
- updateRAG(id: string): Promise<{
2189
- metadata: {
2190
- id: string;
2191
- };
2192
- pageContent: string;
2193
- }>;
2194
- clearRAGs(): Promise<boolean>;
2195
- getRAG(id: string): Promise<{
2196
- metadata: {
2197
- id: string;
2198
- };
2199
- pageContent: string;
2200
- } | null>;
2201
- getRAGs(keyword: string): Promise<{
2202
- metadata: {
2203
- id: string;
2204
- };
2205
- pageContent: string;
2206
- }[]>;
2207
- getMessage(chatId: string): Promise<{
2208
- channelId: string;
2209
- uniqueId: string;
2210
- message: (...args: unknown[]) => Record<string, any>;
2211
- senderId: string;
2212
- roomId: string;
2213
- isGroup: boolean;
2214
- text: string | null;
2215
- chatId: string;
2216
- receiverId: string;
2217
- receiverName: string;
2218
- roomName: string;
2219
- senderName: string;
2220
- senderDevice: "unknown" | "android" | "ios" | "desktop" | "web";
2221
- chatType: "text" | "image" | "contact" | "location" | "document" | "audio" | "video" | "protocol" | "contactsArray" | "highlyStructured" | "sendPayment" | "liveLocation" | "requestPayment" | "declinePaymentRequest" | "cancelPaymentRequest" | "template" | "sticker" | "groupInvite" | "templateButtonReply" | "product" | "deviceSent" | "list" | "viewOnce" | "order" | "listResponse" | "ephemeral" | "invoice" | "buttons" | "buttonsResponse" | "paymentInvite" | "interactive" | "reaction" | "interactiveResponse" | "pollCreation" | "pollUpdate" | "keepInChat" | "requestPhoneNumber" | "scheduledCallCreation" | "groupMentioned" | "pinInChat" | "scheduledCallEdit" | "ptv" | "botInvoke" | "callLog" | "encComment" | "bcall" | "lottieSticker" | "event" | "comment" | "placeholder" | "encEventUpdate";
2222
- timestamp: number;
2223
- mentions: string[];
2224
- links: string[];
2225
- isPrefix: boolean;
2226
- isSpam: boolean;
2227
- isFromMe: boolean;
2228
- isTagMe: boolean;
2229
- isStory: boolean;
2230
- isViewOnce: boolean;
2231
- isEdited: boolean;
2232
- isDeleted: boolean;
2233
- isPinned: boolean;
2234
- isUnPinned: boolean;
2235
- isChannel: boolean;
2236
- isBroadcast: boolean;
2237
- isEphemeral: boolean;
2238
- isForwarded: boolean;
2239
- citation: Record<string, boolean> | null;
2240
- media: z.objectOutputType<{
2241
- buffer: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>>;
2242
- stream: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<stream.Readable, z.ZodTypeDef, stream.Readable>>;
2243
- }, z.ZodTypeAny, "passthrough"> | null;
2244
- replied: {
2245
- channelId: string;
2246
- uniqueId: string;
2247
- message: (...args: unknown[]) => Record<string, any>;
2248
- senderId: string;
2249
- roomId: string;
2250
- isGroup: boolean;
2251
- text: string | null;
2252
- chatId: string;
2253
- receiverId: string;
2254
- receiverName: string;
2255
- roomName: string;
2256
- senderName: string;
2257
- senderDevice: "unknown" | "android" | "ios" | "desktop" | "web";
2258
- chatType: "text" | "image" | "contact" | "location" | "document" | "audio" | "video" | "protocol" | "contactsArray" | "highlyStructured" | "sendPayment" | "liveLocation" | "requestPayment" | "declinePaymentRequest" | "cancelPaymentRequest" | "template" | "sticker" | "groupInvite" | "templateButtonReply" | "product" | "deviceSent" | "list" | "viewOnce" | "order" | "listResponse" | "ephemeral" | "invoice" | "buttons" | "buttonsResponse" | "paymentInvite" | "interactive" | "reaction" | "interactiveResponse" | "pollCreation" | "pollUpdate" | "keepInChat" | "requestPhoneNumber" | "scheduledCallCreation" | "groupMentioned" | "pinInChat" | "scheduledCallEdit" | "ptv" | "botInvoke" | "callLog" | "encComment" | "bcall" | "lottieSticker" | "event" | "comment" | "placeholder" | "encEventUpdate";
2259
- timestamp: number;
2260
- mentions: string[];
2261
- links: string[];
2262
- isPrefix: boolean;
2263
- isSpam: boolean;
2264
- isFromMe: boolean;
2265
- isTagMe: boolean;
2266
- isStory: boolean;
2267
- isViewOnce: boolean;
2268
- isEdited: boolean;
2269
- isDeleted: boolean;
2270
- isPinned: boolean;
2271
- isUnPinned: boolean;
2272
- isChannel: boolean;
2273
- isBroadcast: boolean;
2274
- isEphemeral: boolean;
2275
- isForwarded: boolean;
2276
- citation: Record<string, boolean> | null;
2277
- media: z.objectOutputType<{
2278
- buffer: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>>;
2279
- stream: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<stream.Readable, z.ZodTypeDef, stream.Readable>>;
2280
- }, z.ZodTypeAny, "passthrough"> | null;
2281
- } | null;
2282
- } | null>;
2140
+ private addCompletion;
2141
+ private deleteCompletion;
2142
+ private updateCompletion;
2143
+ private clearCompletions;
2144
+ private getCompletion;
2145
+ private getCompletions;
2146
+ private addPersonalization;
2147
+ private deletePersonalization;
2148
+ private clearPersonalization;
2149
+ private getPersonalization;
2150
+ private addRAG;
2151
+ private deleteRAG;
2152
+ private updateRAG;
2153
+ private clearRAGs;
2154
+ private getRAG;
2155
+ private getRAGs;
2156
+ private getMessage;
2283
2157
  llms: llmsAdapter;
2284
2158
  chats: chatsAdapter;
2285
2159
  }
package/dist/index.d.ts CHANGED
@@ -2137,149 +2137,23 @@ declare class Worker {
2137
2137
  mute(mute: z.infer<typeof MuteWorkerBaseType>, options: z.infer<typeof MuteWorkerOptionsType>): Promise<void | undefined>;
2138
2138
  profile(roomId: z.infer<typeof ProfileWorkerBaseType>): Promise<z.infer<typeof ProfileWorkerBaseOutputType> | null>;
2139
2139
  presence(action: z.infer<typeof PresenceWorkerBaseType>, options: z.infer<typeof PresenceWorkerOptionsType>): Promise<void | undefined>;
2140
- addCompletion(props: z.infer<typeof llmMessagesTable>): Promise<{
2141
- channelId: string;
2142
- uniqueId: string;
2143
- role: string;
2144
- content: string;
2145
- model?: string | null | undefined;
2146
- additional?: string | null | undefined;
2147
- }>;
2148
- deleteCompletion(uniqueId: string): Promise<boolean>;
2149
- updateCompletion(uniqueId: string, props: Partial<z.infer<typeof llmMessagesTable>>): Promise<{
2150
- channelId: string;
2151
- uniqueId: string;
2152
- role: string;
2153
- content: string;
2154
- model?: string | null | undefined;
2155
- additional?: string | null | undefined;
2156
- }>;
2157
- clearCompletions(channelId: string): Promise<boolean>;
2158
- getCompletion(uniqueId: string): Promise<{
2159
- channelId: string;
2160
- uniqueId: string;
2161
- role: string;
2162
- content: string;
2163
- model?: string | null | undefined;
2164
- additional?: string | null | undefined;
2165
- } | null>;
2166
- getCompletions(channelId: string): Promise<{
2167
- channelId: string;
2168
- uniqueId: string;
2169
- role: string;
2170
- content: string;
2171
- model?: string | null | undefined;
2172
- additional?: string | null | undefined;
2173
- }[]>;
2174
- addPersonalization(props: z.infer<typeof llmPersonalizationTable>): Promise<{
2175
- uniqueId: string;
2176
- content: string;
2177
- senderId: string;
2178
- }>;
2179
- deletePersonalization(uniqueId: string): Promise<boolean>;
2180
- clearPersonalization(senderId: string): Promise<boolean>;
2181
- getPersonalization(senderId: string): Promise<{
2182
- uniqueId: string;
2183
- content: string;
2184
- senderId: string;
2185
- }[]>;
2186
- addRAG(props: z.infer<typeof addRAGType>): Promise<any>;
2187
- deleteRAG(id: string): Promise<boolean>;
2188
- updateRAG(id: string): Promise<{
2189
- metadata: {
2190
- id: string;
2191
- };
2192
- pageContent: string;
2193
- }>;
2194
- clearRAGs(): Promise<boolean>;
2195
- getRAG(id: string): Promise<{
2196
- metadata: {
2197
- id: string;
2198
- };
2199
- pageContent: string;
2200
- } | null>;
2201
- getRAGs(keyword: string): Promise<{
2202
- metadata: {
2203
- id: string;
2204
- };
2205
- pageContent: string;
2206
- }[]>;
2207
- getMessage(chatId: string): Promise<{
2208
- channelId: string;
2209
- uniqueId: string;
2210
- message: (...args: unknown[]) => Record<string, any>;
2211
- senderId: string;
2212
- roomId: string;
2213
- isGroup: boolean;
2214
- text: string | null;
2215
- chatId: string;
2216
- receiverId: string;
2217
- receiverName: string;
2218
- roomName: string;
2219
- senderName: string;
2220
- senderDevice: "unknown" | "android" | "ios" | "desktop" | "web";
2221
- chatType: "text" | "image" | "contact" | "location" | "document" | "audio" | "video" | "protocol" | "contactsArray" | "highlyStructured" | "sendPayment" | "liveLocation" | "requestPayment" | "declinePaymentRequest" | "cancelPaymentRequest" | "template" | "sticker" | "groupInvite" | "templateButtonReply" | "product" | "deviceSent" | "list" | "viewOnce" | "order" | "listResponse" | "ephemeral" | "invoice" | "buttons" | "buttonsResponse" | "paymentInvite" | "interactive" | "reaction" | "interactiveResponse" | "pollCreation" | "pollUpdate" | "keepInChat" | "requestPhoneNumber" | "scheduledCallCreation" | "groupMentioned" | "pinInChat" | "scheduledCallEdit" | "ptv" | "botInvoke" | "callLog" | "encComment" | "bcall" | "lottieSticker" | "event" | "comment" | "placeholder" | "encEventUpdate";
2222
- timestamp: number;
2223
- mentions: string[];
2224
- links: string[];
2225
- isPrefix: boolean;
2226
- isSpam: boolean;
2227
- isFromMe: boolean;
2228
- isTagMe: boolean;
2229
- isStory: boolean;
2230
- isViewOnce: boolean;
2231
- isEdited: boolean;
2232
- isDeleted: boolean;
2233
- isPinned: boolean;
2234
- isUnPinned: boolean;
2235
- isChannel: boolean;
2236
- isBroadcast: boolean;
2237
- isEphemeral: boolean;
2238
- isForwarded: boolean;
2239
- citation: Record<string, boolean> | null;
2240
- media: z.objectOutputType<{
2241
- buffer: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>>;
2242
- stream: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<stream.Readable, z.ZodTypeDef, stream.Readable>>;
2243
- }, z.ZodTypeAny, "passthrough"> | null;
2244
- replied: {
2245
- channelId: string;
2246
- uniqueId: string;
2247
- message: (...args: unknown[]) => Record<string, any>;
2248
- senderId: string;
2249
- roomId: string;
2250
- isGroup: boolean;
2251
- text: string | null;
2252
- chatId: string;
2253
- receiverId: string;
2254
- receiverName: string;
2255
- roomName: string;
2256
- senderName: string;
2257
- senderDevice: "unknown" | "android" | "ios" | "desktop" | "web";
2258
- chatType: "text" | "image" | "contact" | "location" | "document" | "audio" | "video" | "protocol" | "contactsArray" | "highlyStructured" | "sendPayment" | "liveLocation" | "requestPayment" | "declinePaymentRequest" | "cancelPaymentRequest" | "template" | "sticker" | "groupInvite" | "templateButtonReply" | "product" | "deviceSent" | "list" | "viewOnce" | "order" | "listResponse" | "ephemeral" | "invoice" | "buttons" | "buttonsResponse" | "paymentInvite" | "interactive" | "reaction" | "interactiveResponse" | "pollCreation" | "pollUpdate" | "keepInChat" | "requestPhoneNumber" | "scheduledCallCreation" | "groupMentioned" | "pinInChat" | "scheduledCallEdit" | "ptv" | "botInvoke" | "callLog" | "encComment" | "bcall" | "lottieSticker" | "event" | "comment" | "placeholder" | "encEventUpdate";
2259
- timestamp: number;
2260
- mentions: string[];
2261
- links: string[];
2262
- isPrefix: boolean;
2263
- isSpam: boolean;
2264
- isFromMe: boolean;
2265
- isTagMe: boolean;
2266
- isStory: boolean;
2267
- isViewOnce: boolean;
2268
- isEdited: boolean;
2269
- isDeleted: boolean;
2270
- isPinned: boolean;
2271
- isUnPinned: boolean;
2272
- isChannel: boolean;
2273
- isBroadcast: boolean;
2274
- isEphemeral: boolean;
2275
- isForwarded: boolean;
2276
- citation: Record<string, boolean> | null;
2277
- media: z.objectOutputType<{
2278
- buffer: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>>;
2279
- stream: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<stream.Readable, z.ZodTypeDef, stream.Readable>>;
2280
- }, z.ZodTypeAny, "passthrough"> | null;
2281
- } | null;
2282
- } | null>;
2140
+ private addCompletion;
2141
+ private deleteCompletion;
2142
+ private updateCompletion;
2143
+ private clearCompletions;
2144
+ private getCompletion;
2145
+ private getCompletions;
2146
+ private addPersonalization;
2147
+ private deletePersonalization;
2148
+ private clearPersonalization;
2149
+ private getPersonalization;
2150
+ private addRAG;
2151
+ private deleteRAG;
2152
+ private updateRAG;
2153
+ private clearRAGs;
2154
+ private getRAG;
2155
+ private getRAGs;
2156
+ private getMessage;
2283
2157
  llms: llmsAdapter;
2284
2158
  chats: chatsAdapter;
2285
2159
  }
@@ -3,7 +3,7 @@ import { createPartFromUri, createUserContent, GoogleGenAI } from "@google/genai
3
3
  import { Client } from "../src";
4
4
  // import { Client } from "zaileys";
5
5
 
6
- const agent = new GoogleGenAI({ apiKey: "AIzaSyCE8ml8-tcfXVChsfYiqR-Z1W1ovHZSIh8" });
6
+ const agent = new GoogleGenAI({ apiKey: "YOUR_GEMINI_APIKEY" });
7
7
 
8
8
  const wa = new Client({
9
9
  authType: "qr", // has issue with pairing code, just use qr only
@@ -23,16 +23,14 @@ wa.on("messages", async (ctx) => {
23
23
  const speech = await agent.models
24
24
  .generateContent({
25
25
  model: "gemini-2.0-flash-001",
26
- contents: createUserContent([{ text: "Please transcribe this audio:" }, createPartFromUri(uploaded.uri!, uploaded.mimeType!)]),
26
+ contents: createUserContent([
27
+ {
28
+ text: "Transcribe it internally, but do not output the transcription. Simply respond to the message as if you were replying naturally in a conversation. Be direct, contextual, and human-like—no need to mention the transcription process or analyze the speaker’s intent.",
29
+ },
30
+ createPartFromUri(uploaded.uri!, uploaded.mimeType!),
31
+ ]),
27
32
  })
28
33
  .then((x) => x.candidates?.[0].content?.parts?.[0].text || "");
29
34
 
30
- const answer = await agent.models
31
- .generateContent({
32
- model: "gemini-2.0-flash-001",
33
- contents: speech,
34
- })
35
- .then((x) => x.candidates?.[0].content?.parts?.[0].text || "");
36
-
37
- await wa.text(answer, { roomId: ctx.roomId });
35
+ await wa.text(speech, { roomId: ctx.roomId });
38
36
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zaileys",
3
- "version": "1.1.31",
3
+ "version": "1.1.32",
4
4
  "description": "Zaileys - Simplified WhatsApp Node.js API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",