@builderbot/provider-baileys 1.2.3-alpha.3 → 1.2.3-alpha.4
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/baileyWrapper.d.ts +1 -1
- package/dist/baileyWrapper.d.ts.map +1 -1
- package/dist/bindStore.d.ts +5 -5
- package/dist/bindStore.d.ts.map +1 -1
- package/dist/index.cjs +22 -22
- package/package.json +4 -4
package/dist/baileyWrapper.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMultiFileAuthState, DisconnectReason, proto, makeInMemoryStore, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, PollMessageOptions, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast } from '@
|
|
1
|
+
import { useMultiFileAuthState, DisconnectReason, proto, makeInMemoryStore, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, PollMessageOptions, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast } from '@builderbot/core-baileys';
|
|
2
2
|
declare const makeWASocketOther: any;
|
|
3
3
|
export { makeWASocketOther, useMultiFileAuthState, DisconnectReason, proto, makeInMemoryStore, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, PollMessageOptions, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast, };
|
|
4
4
|
//# sourceMappingURL=baileyWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baileyWrapper.d.ts","sourceRoot":"","sources":["../src/baileyWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,8BAA8B,EAC9B,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,EACjB,MAAM,
|
|
1
|
+
{"version":3,"file":"baileyWrapper.d.ts","sourceRoot":"","sources":["../src/baileyWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,8BAA8B,EAC9B,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,EACjB,MAAM,0BAA0B,CAAA;AAEjC,QAAA,MAAM,iBAAiB,KAA8C,CAAA;AAErE,OAAO,EACH,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,8BAA8B,EAC9B,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,GACjB,CAAA"}
|
package/dist/bindStore.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type KeyedDB from '@adiwajshing/keyed-db';
|
|
2
2
|
import type { Comparable } from '@adiwajshing/keyed-db/lib/Types';
|
|
3
|
-
import { proto } from '@
|
|
4
|
-
import type { BaileysEventEmitter, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessageCursor, WAMessageKey, Chat, WAMessage, makeWASocket } from '@
|
|
5
|
-
import { ObjectRepository } from '@
|
|
6
|
-
import type { Label } from '@
|
|
7
|
-
import type { LabelAssociation } from '@
|
|
3
|
+
import { proto } from '@builderbot/core-baileys';
|
|
4
|
+
import type { BaileysEventEmitter, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessageCursor, WAMessageKey, Chat, WAMessage, makeWASocket } from '@builderbot/core-baileys';
|
|
5
|
+
import { ObjectRepository } from '@builderbot/core-baileys/lib/Store/object-repository';
|
|
6
|
+
import type { Label } from '@builderbot/core-baileys/lib/Types/Label';
|
|
7
|
+
import type { LabelAssociation } from '@builderbot/core-baileys/lib/Types/LabelAssociation';
|
|
8
8
|
import type { Logger } from 'pino';
|
|
9
9
|
type WASocket = ReturnType<typeof makeWASocket>;
|
|
10
10
|
export declare const waChatKey: (pin: boolean) => {
|
package/dist/bindStore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindStore.d.ts","sourceRoot":"","sources":["../src/bindStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAgD,KAAK,EAAY,MAAM,
|
|
1
|
+
{"version":3,"file":"bindStore.d.ts","sourceRoot":"","sources":["../src/bindStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,EAAgD,KAAK,EAAY,MAAM,0BAA0B,CAAA;AACxG,OAAO,KAAK,EACR,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,YAAY,EACf,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAA;AACvF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAA;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAA2B,MAAM,qDAAqD,CAAA;AAEpH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,KAAK,QAAQ,GAAG,UAAU,CAAC,OA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AAO,EAAE,MAAM,GAAG,KAAK,CAAA;SAAE,CAAA;QACpC,iBAAiB,EAAE,gBAAgB,EAAE,CAAA;KACxC;wBA4HuB,MAAM;yBAKL,MAAM;;AA3anC,wBAsbC"}
|
package/dist/index.cjs
CHANGED
|
@@ -22,9 +22,9 @@ var require$$1$3 = require('tty');
|
|
|
22
22
|
var require$$0$a = require('crypto');
|
|
23
23
|
var require$$0$c = require('sharp');
|
|
24
24
|
var require$$0$b = require('fluent-ffmpeg');
|
|
25
|
-
var
|
|
26
|
-
var objectRepository = require('@
|
|
27
|
-
var LabelAssociation = require('@
|
|
25
|
+
var coreBaileys = require('@builderbot/core-baileys');
|
|
26
|
+
var objectRepository = require('@builderbot/core-baileys/lib/Store/object-repository');
|
|
27
|
+
var LabelAssociation = require('@builderbot/core-baileys/lib/Types/LabelAssociation');
|
|
28
28
|
|
|
29
29
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
30
30
|
|
|
@@ -30010,7 +30010,7 @@ function requireDist () {
|
|
|
30010
30010
|
|
|
30011
30011
|
var distExports = requireDist();
|
|
30012
30012
|
|
|
30013
|
-
const makeWASocketOther = require('@
|
|
30013
|
+
const makeWASocketOther = require('@builderbot/core-baileys').default;
|
|
30014
30014
|
|
|
30015
30015
|
//eventos a evitar "READ"
|
|
30016
30016
|
function makeOrderedDictionary(idGetter) {
|
|
@@ -30107,7 +30107,7 @@ const makeMessagesDictionary = () => makeOrderedDictionary(waMessageID);
|
|
|
30107
30107
|
var bindStore = (config) => {
|
|
30108
30108
|
const chatKey = config.chatKey || waChatKey();
|
|
30109
30109
|
const labelAssociationKey = config.labelAssociationKey || waLabelAssociationKey;
|
|
30110
|
-
const logger = config.logger ||
|
|
30110
|
+
const logger = config.logger || coreBaileys.DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' });
|
|
30111
30111
|
const KeyedDB = require('@adiwajshing/keyed-db').default;
|
|
30112
30112
|
const chats = new KeyedDB(chatKey, (c) => c.id);
|
|
30113
30113
|
const messages = {};
|
|
@@ -30251,7 +30251,7 @@ var bindStore = (config) => {
|
|
|
30251
30251
|
case 'append':
|
|
30252
30252
|
case 'notify':
|
|
30253
30253
|
for (const msg of newMessages) {
|
|
30254
|
-
const jid =
|
|
30254
|
+
const jid = coreBaileys.jidNormalizedUser(msg.key.remoteJid);
|
|
30255
30255
|
const list = assertMessageList(jid);
|
|
30256
30256
|
list.upsert(msg, 'append');
|
|
30257
30257
|
if (type === 'notify') {
|
|
@@ -30259,7 +30259,7 @@ var bindStore = (config) => {
|
|
|
30259
30259
|
ev.emit('chats.upsert', [
|
|
30260
30260
|
{
|
|
30261
30261
|
id: jid,
|
|
30262
|
-
conversationTimestamp:
|
|
30262
|
+
conversationTimestamp: coreBaileys.toNumber(msg.messageTimestamp),
|
|
30263
30263
|
unreadCount: 1,
|
|
30264
30264
|
},
|
|
30265
30265
|
]);
|
|
@@ -30364,7 +30364,7 @@ var bindStore = (config) => {
|
|
|
30364
30364
|
for (const jid in json.messages) {
|
|
30365
30365
|
const list = assertMessageList(jid);
|
|
30366
30366
|
for (const msg of json.messages[jid]) {
|
|
30367
|
-
list.upsert(
|
|
30367
|
+
list.upsert(coreBaileys.proto.WebMessageInfo.fromObject(msg), 'append');
|
|
30368
30368
|
}
|
|
30369
30369
|
}
|
|
30370
30370
|
};
|
|
@@ -30575,7 +30575,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30575
30575
|
return msg?.message || undefined;
|
|
30576
30576
|
}
|
|
30577
30577
|
// only if store is present
|
|
30578
|
-
return
|
|
30578
|
+
return coreBaileys.proto.Message.fromObject({});
|
|
30579
30579
|
};
|
|
30580
30580
|
this.saveCredsGlobal = null;
|
|
30581
30581
|
/**
|
|
@@ -30583,13 +30583,13 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30583
30583
|
*/
|
|
30584
30584
|
this.initVendor = async () => {
|
|
30585
30585
|
const NAME_DIR_SESSION = `${this.globalVendorArgs.name}_sessions`;
|
|
30586
|
-
const { state, saveCreds } = await
|
|
30586
|
+
const { state, saveCreds } = await coreBaileys.useMultiFileAuthState(NAME_DIR_SESSION);
|
|
30587
30587
|
const loggerBaileys = pino$1({ level: 'fatal' });
|
|
30588
30588
|
this.saveCredsGlobal = saveCreds;
|
|
30589
30589
|
try {
|
|
30590
30590
|
if (this.globalVendorArgs.useBaileysStore) {
|
|
30591
30591
|
this.store = !this.globalVendorArgs.experimentalStore
|
|
30592
|
-
?
|
|
30592
|
+
? coreBaileys.makeInMemoryStore({ logger: loggerBaileys })
|
|
30593
30593
|
: bindStore({ logger: loggerBaileys });
|
|
30594
30594
|
if (this.store?.readFromFile)
|
|
30595
30595
|
this.store?.readFromFile(`${NAME_DIR_SESSION}/baileys_store.json`);
|
|
@@ -30614,7 +30614,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30614
30614
|
printQRInTerminal: false,
|
|
30615
30615
|
auth: {
|
|
30616
30616
|
creds: state.creds,
|
|
30617
|
-
keys:
|
|
30617
|
+
keys: coreBaileys.makeCacheableSignalKeyStore(state.keys, loggerBaileys),
|
|
30618
30618
|
},
|
|
30619
30619
|
browser: this.globalVendorArgs.browser,
|
|
30620
30620
|
syncFullHistory: false,
|
|
@@ -30626,20 +30626,20 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30626
30626
|
connectTimeoutMs: 20_000,
|
|
30627
30627
|
keepAliveIntervalMs: 30_000,
|
|
30628
30628
|
shouldIgnoreJid: (jid) => {
|
|
30629
|
-
const isGroupJid = this.globalVendorArgs.groupsIgnore &&
|
|
30630
|
-
const isBroadcast = !this.globalVendorArgs.readStatus &&
|
|
30629
|
+
const isGroupJid = this.globalVendorArgs.groupsIgnore && coreBaileys.isJidGroup(jid);
|
|
30630
|
+
const isBroadcast = !this.globalVendorArgs.readStatus && coreBaileys.isJidBroadcast(jid);
|
|
30631
30631
|
return isGroupJid || isBroadcast;
|
|
30632
30632
|
},
|
|
30633
30633
|
patchMessageBeforeSending: (message) => {
|
|
30634
30634
|
if (message.deviceSentMessage?.message?.listMessage?.listType ===
|
|
30635
|
-
|
|
30635
|
+
coreBaileys.proto.Message.ListMessage.ListType.PRODUCT_LIST) {
|
|
30636
30636
|
message = JSON.parse(JSON.stringify(message));
|
|
30637
30637
|
message.deviceSentMessage.message.listMessage.listType =
|
|
30638
|
-
|
|
30638
|
+
coreBaileys.proto.Message.ListMessage.ListType.SINGLE_SELECT;
|
|
30639
30639
|
}
|
|
30640
|
-
if (message.listMessage?.listType ==
|
|
30640
|
+
if (message.listMessage?.listType == coreBaileys.proto.Message.ListMessage.ListType.PRODUCT_LIST) {
|
|
30641
30641
|
message = JSON.parse(JSON.stringify(message));
|
|
30642
|
-
message.listMessage.listType =
|
|
30642
|
+
message.listMessage.listType = coreBaileys.proto.Message.ListMessage.ListType.SINGLE_SELECT;
|
|
30643
30643
|
}
|
|
30644
30644
|
return message;
|
|
30645
30645
|
},
|
|
@@ -30677,11 +30677,11 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30677
30677
|
const statusCode = lastDisconnect?.error?.output?.statusCode;
|
|
30678
30678
|
/** Connection closed for various reasons */
|
|
30679
30679
|
if (connection === 'close') {
|
|
30680
|
-
if (statusCode !==
|
|
30680
|
+
if (statusCode !== coreBaileys.DisconnectReason.loggedOut) {
|
|
30681
30681
|
this.initVendor().then((v) => this.listenOnEvents(v));
|
|
30682
30682
|
return;
|
|
30683
30683
|
}
|
|
30684
|
-
if (statusCode ===
|
|
30684
|
+
if (statusCode === coreBaileys.DisconnectReason.loggedOut) {
|
|
30685
30685
|
const PATH_BASE = require$$1$1.join(process.cwd(), NAME_DIR_SESSION);
|
|
30686
30686
|
await emptyDirSessions(PATH_BASE);
|
|
30687
30687
|
this.initVendor().then((v) => this.listenOnEvents(v));
|
|
@@ -30862,7 +30862,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30862
30862
|
if (update.pollUpdates) {
|
|
30863
30863
|
const pollCreation = await this.getMessage(key);
|
|
30864
30864
|
if (pollCreation) {
|
|
30865
|
-
const pollMessage =
|
|
30865
|
+
const pollMessage = coreBaileys.getAggregateVotesInPollMessage({
|
|
30866
30866
|
message: pollCreation,
|
|
30867
30867
|
pollUpdates: update.pollUpdates,
|
|
30868
30868
|
});
|
|
@@ -31146,7 +31146,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
31146
31146
|
if (!mimeType)
|
|
31147
31147
|
throw new Error('MIME type not found');
|
|
31148
31148
|
const extension = mime.extension(mimeType);
|
|
31149
|
-
const buffer = await
|
|
31149
|
+
const buffer = await coreBaileys.downloadMediaMessage(ctx, 'buffer', {});
|
|
31150
31150
|
const fileName = this.generateFileName(extension);
|
|
31151
31151
|
const pathFile = require$$1$1.join(options?.path ?? require$$0$9.tmpdir(), fileName);
|
|
31152
31152
|
await promises.writeFile(pathFile, buffer);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builderbot/provider-baileys",
|
|
3
|
-
"version": "1.2.3-alpha.
|
|
3
|
+
"version": "1.2.3-alpha.4",
|
|
4
4
|
"description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Leifer Mendez <leifer33@gmail.com>",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@builderbot/bot": "^1.2.3-alpha.
|
|
33
|
+
"@builderbot/bot": "^1.2.3-alpha.4",
|
|
34
34
|
"@hapi/boom": "^10.0.1",
|
|
35
35
|
"@jest/globals": "^29.7.0",
|
|
36
36
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
62
|
+
"@builderbot/core-baileys": "~6.7.5",
|
|
62
63
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
63
64
|
"@types/polka": "^0.5.7",
|
|
64
|
-
"@whiskeysockets/baileys": "~6.7.9",
|
|
65
65
|
"fluent-ffmpeg": "^2.1.2",
|
|
66
66
|
"fs-extra": "^11.2.0"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "7255974a965ae04d325a5d239fc1995b3c6ac621"
|
|
69
69
|
}
|