@builderbot/provider-baileys 1.1.7 → 1.1.8-alpha.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/dist/bailey.d.ts +2 -2
- package/dist/bailey.d.ts.map +1 -1
- package/dist/bindStore.d.ts +117 -0
- package/dist/bindStore.d.ts.map +1 -0
- package/dist/index.cjs +491 -3
- package/dist/type.d.ts +1 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/bailey.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import type { BotContext, Button, SendOptions } from '@builderbot/bot/dist/types
|
|
|
5
5
|
import type { PathOrFileDescriptor } from 'fs';
|
|
6
6
|
import type polka from 'polka';
|
|
7
7
|
import type { IStickerOptions } from 'wa-sticker-formatter';
|
|
8
|
-
|
|
9
|
-
import { makeInMemoryStore, proto } from './baileyWrapper';
|
|
8
|
+
|
|
9
|
+
import type { BaileysEventMap, WAMessage, WASocket , makeInMemoryStore, proto } from './baileyWrapper';
|
|
10
10
|
import type { BaileyGlobalVendorArgs } from './type';
|
|
11
11
|
declare class BaileysProvider extends ProviderClass<WASocket> {
|
|
12
12
|
globalVendorArgs: BaileyGlobalVendorArgs;
|
package/dist/bailey.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bailey.d.ts","sourceRoot":"","sources":["../src/bailey.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAA;AAO9C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAG3D,OAAO,KAAK,EAGR,eAAe,EAEf,SAAS,EACT,QAAQ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AAqB,GAAG,cAAc,GAAG,mBAE1D;IAED;;;;;;OAMG;IAEH,WAAW,cACI,GAAG,OACT,MAAM,GAAG,MAAM,kBACJ,QAAQ,eAAe,CAAC,aAC9B,GAAG,mBAWhB;IAED,OAAO,CAAC,WAAW,CAMlB;IAED,OAAO,CAAC,gBAAgB,CAAmE;IAE3F;;;;;OAKG;IACH,QAAQ,QAAe,QAAQ,SAAS,GAAG,UAAU,CAAC,YAAY;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,QAAQ,MAAM,CAAC,CAUnG;CACJ;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type KeyedDB from '@adiwajshing/keyed-db';
|
|
2
|
+
import type { Comparable } from '@adiwajshing/keyed-db/lib/Types';
|
|
3
|
+
import type { proto , BaileysEventEmitter, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessageCursor, WAMessageKey, Chat, WAMessage, makeWASocket } from '@whiskeysockets/baileys';
|
|
4
|
+
import type { ObjectRepository } from '@whiskeysockets/baileys/lib/Store/object-repository';
|
|
5
|
+
import type { Label } from '@whiskeysockets/baileys/lib/Types/Label';
|
|
6
|
+
import type { LabelAssociation } from '@whiskeysockets/baileys/lib/Types/LabelAssociation';
|
|
7
|
+
import type { Logger } from 'pino';
|
|
8
|
+
type WASocket = ReturnType<typeof makeWASocket>;
|
|
9
|
+
export declare const waChatKey: (pin: boolean) => {
|
|
10
|
+
key: (c: Chat) => string;
|
|
11
|
+
compare: (k1: string, k2: string) => number;
|
|
12
|
+
};
|
|
13
|
+
export declare const waMessageID: (m: WAMessage) => string;
|
|
14
|
+
export declare const waLabelAssociationKey: Comparable<LabelAssociation, string>;
|
|
15
|
+
export type BaileysInMemoryStoreConfig = {
|
|
16
|
+
chatKey?: Comparable<Chat, string>;
|
|
17
|
+
labelAssociationKey?: Comparable<LabelAssociation, string>;
|
|
18
|
+
logger?: Logger;
|
|
19
|
+
socket?: WASocket;
|
|
20
|
+
};
|
|
21
|
+
declare const _default: (config: BaileysInMemoryStoreConfig) => {
|
|
22
|
+
chats: KeyedDB<Chat, string>;
|
|
23
|
+
contacts: {
|
|
24
|
+
[_: string]: Contact;
|
|
25
|
+
};
|
|
26
|
+
messages: {
|
|
27
|
+
[_: string]: {
|
|
28
|
+
array: proto.IWebMessageInfo[];
|
|
29
|
+
get: (id: string) => proto.IWebMessageInfo;
|
|
30
|
+
upsert: (item: proto.IWebMessageInfo, mode: "append" | "prepend") => void;
|
|
31
|
+
update: (item: proto.IWebMessageInfo) => boolean;
|
|
32
|
+
remove: (item: proto.IWebMessageInfo) => boolean;
|
|
33
|
+
updateAssign: (id: string, update: Partial<proto.IWebMessageInfo>) => boolean;
|
|
34
|
+
clear: () => void;
|
|
35
|
+
filter: (contain: (item: proto.IWebMessageInfo) => boolean) => void;
|
|
36
|
+
toJSON: () => proto.IWebMessageInfo[];
|
|
37
|
+
fromJSON: (newItems: proto.IWebMessageInfo[]) => void;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
groupMetadata: {
|
|
41
|
+
[_: string]: GroupMetadata;
|
|
42
|
+
};
|
|
43
|
+
state: ConnectionState;
|
|
44
|
+
presences: {
|
|
45
|
+
[id: string]: {
|
|
46
|
+
[participant: string]: PresenceData;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
labels: ObjectRepository<Label>;
|
|
50
|
+
labelAssociations: KeyedDB<LabelAssociation, string>;
|
|
51
|
+
bind: (ev: BaileysEventEmitter) => void;
|
|
52
|
+
/** loads messages from the store, if not found -- uses the legacy connection */
|
|
53
|
+
loadMessages: (jid: string, count: number, cursor: WAMessageCursor) => Promise<proto.IWebMessageInfo[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Get all available labels for profile
|
|
56
|
+
*
|
|
57
|
+
* Keep in mind that the list is formed from predefined tags and tags
|
|
58
|
+
* that were "caught" during their editing.
|
|
59
|
+
*/
|
|
60
|
+
getLabels: () => ObjectRepository<Label>;
|
|
61
|
+
/**
|
|
62
|
+
* Get labels for chat
|
|
63
|
+
*
|
|
64
|
+
* @returns Label IDs
|
|
65
|
+
**/
|
|
66
|
+
getChatLabels: (chatId: string) => LabelAssociation[];
|
|
67
|
+
/**
|
|
68
|
+
* Get labels for message
|
|
69
|
+
*
|
|
70
|
+
* @returns Label IDs
|
|
71
|
+
**/
|
|
72
|
+
getMessageLabels: (messageId: string) => string[];
|
|
73
|
+
loadMessage: (jid: string, id: string) => Promise<proto.IWebMessageInfo>;
|
|
74
|
+
mostRecentMessage: (jid: string) => Promise<proto.IWebMessageInfo>;
|
|
75
|
+
fetchImageUrl: (jid: string, sock: WASocket | undefined) => Promise<string>;
|
|
76
|
+
fetchGroupMetadata: (jid: string, sock: WASocket | undefined) => Promise<GroupMetadata>;
|
|
77
|
+
fetchMessageReceipts: ({ remoteJid, id }: WAMessageKey) => Promise<proto.IUserReceipt[]>;
|
|
78
|
+
toJSON: () => {
|
|
79
|
+
chats: KeyedDB<Chat, string>;
|
|
80
|
+
contacts: {
|
|
81
|
+
[_: string]: Contact;
|
|
82
|
+
};
|
|
83
|
+
messages: {
|
|
84
|
+
[_: string]: {
|
|
85
|
+
array: proto.IWebMessageInfo[];
|
|
86
|
+
get: (id: string) => proto.IWebMessageInfo;
|
|
87
|
+
upsert: (item: proto.IWebMessageInfo, mode: "append" | "prepend") => void;
|
|
88
|
+
update: (item: proto.IWebMessageInfo) => boolean;
|
|
89
|
+
remove: (item: proto.IWebMessageInfo) => boolean;
|
|
90
|
+
updateAssign: (id: string, update: Partial<proto.IWebMessageInfo>) => boolean;
|
|
91
|
+
clear: () => void;
|
|
92
|
+
filter: (contain: (item: proto.IWebMessageInfo) => boolean) => void;
|
|
93
|
+
toJSON: () => proto.IWebMessageInfo[];
|
|
94
|
+
fromJSON: (newItems: proto.IWebMessageInfo[]) => void;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
labels: ObjectRepository<Label>;
|
|
98
|
+
labelAssociations: KeyedDB<LabelAssociation, string>;
|
|
99
|
+
};
|
|
100
|
+
fromJSON: (json: {
|
|
101
|
+
chats: Chat[];
|
|
102
|
+
contacts: {
|
|
103
|
+
[id: string]: Contact;
|
|
104
|
+
};
|
|
105
|
+
messages: {
|
|
106
|
+
[id: string]: WAMessage[];
|
|
107
|
+
};
|
|
108
|
+
labels: {
|
|
109
|
+
[labelId: string]: Label;
|
|
110
|
+
};
|
|
111
|
+
labelAssociations: LabelAssociation[];
|
|
112
|
+
}) => void;
|
|
113
|
+
writeToFile: (path: string) => void;
|
|
114
|
+
readFromFile: (path: string) => void;
|
|
115
|
+
};
|
|
116
|
+
export default _default;
|
|
117
|
+
//# sourceMappingURL=bindStore.d.ts.map
|
|
@@ -0,0 +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,yBAAyB,CAAA;AACvG,OAAO,KAAK,EACR,mBAAmB,EACnB,eAAe,EACf,OAAO,EACP,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,YAAY,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAA;AACtF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAA2B,MAAM,oDAAoD,CAAA;AAEnH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;AAyF/C,eAAO,MAAM,SAAS,QAAS,OAAO;aACzB,IAAI;kBAKC,MAAM,MAAM,MAAM;C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|
|
24
24
|
var require$$0$b = require('fluent-ffmpeg');
|
|
25
25
|
var baileys = require('@whiskeysockets/baileys');
|
|
26
|
+
var objectRepository = require('@whiskeysockets/baileys/lib/Store/object-repository');
|
|
27
|
+
var LabelAssociation = require('@whiskeysockets/baileys/lib/Types/LabelAssociation');
|
|
26
28
|
|
|
27
29
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
28
30
|
|
|
@@ -30008,6 +30010,488 @@ var distExports = requireDist();
|
|
|
30008
30010
|
|
|
30009
30011
|
const makeWASocketOther = require('@whiskeysockets/baileys').default;
|
|
30010
30012
|
|
|
30013
|
+
//eventos a evitar "READ"
|
|
30014
|
+
function makeOrderedDictionary(idGetter) {
|
|
30015
|
+
const array = [];
|
|
30016
|
+
const dict = {};
|
|
30017
|
+
const get = (id) => dict[id];
|
|
30018
|
+
const update = (item) => {
|
|
30019
|
+
const id = idGetter(item);
|
|
30020
|
+
const idx = array.findIndex((i) => idGetter(i) === id);
|
|
30021
|
+
if (idx >= 0) {
|
|
30022
|
+
array[idx] = item;
|
|
30023
|
+
dict[id] = item;
|
|
30024
|
+
}
|
|
30025
|
+
return false;
|
|
30026
|
+
};
|
|
30027
|
+
const upsert = (item, mode) => {
|
|
30028
|
+
const id = idGetter(item);
|
|
30029
|
+
if (get(id)) {
|
|
30030
|
+
update(item);
|
|
30031
|
+
}
|
|
30032
|
+
else {
|
|
30033
|
+
if (mode === 'append') {
|
|
30034
|
+
array.push(item);
|
|
30035
|
+
}
|
|
30036
|
+
else {
|
|
30037
|
+
array.splice(0, 0, item);
|
|
30038
|
+
}
|
|
30039
|
+
dict[id] = item;
|
|
30040
|
+
}
|
|
30041
|
+
};
|
|
30042
|
+
const remove = (item) => {
|
|
30043
|
+
const id = idGetter(item);
|
|
30044
|
+
const idx = array.findIndex((i) => idGetter(i) === id);
|
|
30045
|
+
if (idx >= 0) {
|
|
30046
|
+
array.splice(idx, 1);
|
|
30047
|
+
delete dict[id];
|
|
30048
|
+
return true;
|
|
30049
|
+
}
|
|
30050
|
+
return false;
|
|
30051
|
+
};
|
|
30052
|
+
return {
|
|
30053
|
+
array,
|
|
30054
|
+
get,
|
|
30055
|
+
upsert,
|
|
30056
|
+
update,
|
|
30057
|
+
remove,
|
|
30058
|
+
updateAssign: (id, update) => {
|
|
30059
|
+
const item = get(id);
|
|
30060
|
+
if (item) {
|
|
30061
|
+
Object.assign(item, update);
|
|
30062
|
+
delete dict[id];
|
|
30063
|
+
dict[idGetter(item)] = item;
|
|
30064
|
+
return true;
|
|
30065
|
+
}
|
|
30066
|
+
return false;
|
|
30067
|
+
},
|
|
30068
|
+
clear: () => {
|
|
30069
|
+
array.splice(0, array.length);
|
|
30070
|
+
Object.keys(dict).forEach((key) => {
|
|
30071
|
+
delete dict[key];
|
|
30072
|
+
});
|
|
30073
|
+
},
|
|
30074
|
+
filter: (contain) => {
|
|
30075
|
+
let i = 0;
|
|
30076
|
+
while (i < array.length) {
|
|
30077
|
+
if (!contain(array[i])) {
|
|
30078
|
+
delete dict[idGetter(array[i])];
|
|
30079
|
+
array.splice(i, 1);
|
|
30080
|
+
}
|
|
30081
|
+
else {
|
|
30082
|
+
i += 1;
|
|
30083
|
+
}
|
|
30084
|
+
}
|
|
30085
|
+
},
|
|
30086
|
+
toJSON: () => array,
|
|
30087
|
+
fromJSON: (newItems) => {
|
|
30088
|
+
array.splice(0, array.length, ...newItems);
|
|
30089
|
+
},
|
|
30090
|
+
};
|
|
30091
|
+
}
|
|
30092
|
+
const waChatKey = (pin) => ({
|
|
30093
|
+
key: (c) => ((c.pinned ? '1' : '0') ) +
|
|
30094
|
+
(c.archived ? '0' : '1') +
|
|
30095
|
+
(c.conversationTimestamp ? c.conversationTimestamp.toString(16).padStart(8, '0') : '') +
|
|
30096
|
+
c.id,
|
|
30097
|
+
compare: (k1, k2) => k2.localeCompare(k1),
|
|
30098
|
+
});
|
|
30099
|
+
const waMessageID = (m) => m.key.id || '';
|
|
30100
|
+
const waLabelAssociationKey = {
|
|
30101
|
+
key: (la) => la.type === LabelAssociation.LabelAssociationType.Chat ? la.chatId + la.labelId : la.chatId + la.messageId + la.labelId,
|
|
30102
|
+
compare: (k1, k2) => k2.localeCompare(k1),
|
|
30103
|
+
};
|
|
30104
|
+
const makeMessagesDictionary = () => makeOrderedDictionary(waMessageID);
|
|
30105
|
+
var bindStore = (config) => {
|
|
30106
|
+
const chatKey = config.chatKey || waChatKey();
|
|
30107
|
+
const labelAssociationKey = config.labelAssociationKey || waLabelAssociationKey;
|
|
30108
|
+
const logger = config.logger || baileys.DEFAULT_CONNECTION_CONFIG.logger.child({ stream: 'in-mem-store' });
|
|
30109
|
+
const KeyedDB = require('@adiwajshing/keyed-db').default;
|
|
30110
|
+
const chats = new KeyedDB(chatKey, (c) => c.id);
|
|
30111
|
+
const messages = {};
|
|
30112
|
+
const contacts = {};
|
|
30113
|
+
const groupMetadata = {};
|
|
30114
|
+
const presences = {};
|
|
30115
|
+
const state = { connection: 'close' };
|
|
30116
|
+
const labels = new objectRepository.ObjectRepository();
|
|
30117
|
+
const labelAssociations = new KeyedDB(labelAssociationKey, labelAssociationKey.key);
|
|
30118
|
+
const assertMessageList = (jid) => {
|
|
30119
|
+
if (!messages[jid]) {
|
|
30120
|
+
messages[jid] = makeMessagesDictionary();
|
|
30121
|
+
}
|
|
30122
|
+
return messages[jid];
|
|
30123
|
+
};
|
|
30124
|
+
const contactsUpsert = (newContacts) => {
|
|
30125
|
+
const oldContacts = new Set(Object.keys(contacts));
|
|
30126
|
+
for (const contact of newContacts) {
|
|
30127
|
+
oldContacts.delete(contact.id);
|
|
30128
|
+
contacts[contact.id] = Object.assign(contacts[contact.id] || {}, contact);
|
|
30129
|
+
}
|
|
30130
|
+
return oldContacts;
|
|
30131
|
+
};
|
|
30132
|
+
const labelsUpsert = (newLabels) => {
|
|
30133
|
+
for (const label of newLabels) {
|
|
30134
|
+
labels.upsertById(label.id, label);
|
|
30135
|
+
}
|
|
30136
|
+
};
|
|
30137
|
+
/**
|
|
30138
|
+
* binds to a BaileysEventEmitter.
|
|
30139
|
+
* It listens to all events and constructs a state that you can query accurate data from.
|
|
30140
|
+
* Eg. can use the store to fetch chats, contacts, messages etc.
|
|
30141
|
+
* @param ev typically the event emitter from the socket connection
|
|
30142
|
+
*/
|
|
30143
|
+
const bind = (ev) => {
|
|
30144
|
+
ev.on('connection.update', (update) => {
|
|
30145
|
+
Object.assign(state, update);
|
|
30146
|
+
});
|
|
30147
|
+
// ev.on('messaging-history.set', ({
|
|
30148
|
+
// chats: newChats,
|
|
30149
|
+
// contacts: newContacts,
|
|
30150
|
+
// messages: newMessages,
|
|
30151
|
+
// isLatest
|
|
30152
|
+
// }) => {
|
|
30153
|
+
// if (isLatest) {
|
|
30154
|
+
// chats.clear()
|
|
30155
|
+
// for (const id in messages) {
|
|
30156
|
+
// delete messages[id]
|
|
30157
|
+
// }
|
|
30158
|
+
// }
|
|
30159
|
+
// const chatsAdded = chats.insertIfAbsent(...newChats).length
|
|
30160
|
+
// logger.debug({ chatsAdded }, 'synced chats')
|
|
30161
|
+
// const oldContacts = contactsUpsert(newContacts)
|
|
30162
|
+
// if (isLatest) {
|
|
30163
|
+
// for (const jid of oldContacts) {
|
|
30164
|
+
// delete contacts[jid]
|
|
30165
|
+
// }
|
|
30166
|
+
// }
|
|
30167
|
+
// logger.debug({ deletedContacts: isLatest ? oldContacts.size : 0, newContacts }, 'synced contacts')
|
|
30168
|
+
// for (const msg of newMessages) {
|
|
30169
|
+
// const jid = msg.key.remoteJid!
|
|
30170
|
+
// const list = assertMessageList(jid)
|
|
30171
|
+
// list.upsert(msg, 'prepend')
|
|
30172
|
+
// }
|
|
30173
|
+
// logger.debug({ messages: newMessages.length }, 'synced messages')
|
|
30174
|
+
// })
|
|
30175
|
+
// ev.on('contacts.upsert', contacts => {
|
|
30176
|
+
// contactsUpsert(contacts)
|
|
30177
|
+
// })
|
|
30178
|
+
// ev.on('contacts.update', async updates => {
|
|
30179
|
+
// for (const update of updates) {
|
|
30180
|
+
// let contact: Contact
|
|
30181
|
+
// if (contacts[update.id!]) {
|
|
30182
|
+
// contact = contacts[update.id!]
|
|
30183
|
+
// } else {
|
|
30184
|
+
// const contactHashes = await Promise.all(Object.keys(contacts).map(async contactId => {
|
|
30185
|
+
// const { user } = jidDecode(contactId)!
|
|
30186
|
+
// return [contactId, (await md5(Buffer.from(user + 'WA_ADD_NOTIF', 'utf8'))).toString('base64').slice(0, 3)]
|
|
30187
|
+
// }))
|
|
30188
|
+
// contact = contacts[contactHashes.find(([, b]) => b === update.id)?.[0] || ''] // find contact by attrs.hash, when user is not saved as a contact
|
|
30189
|
+
// }
|
|
30190
|
+
// if (contact) {
|
|
30191
|
+
// if (update.imgUrl === 'changed') {
|
|
30192
|
+
// contact.imgUrl = socket ? await socket?.profilePictureUrl(contact.id) : undefined
|
|
30193
|
+
// } else if (update.imgUrl === 'removed') {
|
|
30194
|
+
// delete contact.imgUrl
|
|
30195
|
+
// }
|
|
30196
|
+
// } else {
|
|
30197
|
+
// return logger.debug({ update }, 'got update for non-existant contact')
|
|
30198
|
+
// }
|
|
30199
|
+
// Object.assign(contacts[contact.id], contact)
|
|
30200
|
+
// }
|
|
30201
|
+
// })
|
|
30202
|
+
ev.on('chats.upsert', (newChats) => {
|
|
30203
|
+
chats.upsert(...newChats);
|
|
30204
|
+
});
|
|
30205
|
+
ev.on('chats.update', (updates) => {
|
|
30206
|
+
for (let update of updates) {
|
|
30207
|
+
const result = chats.update(update.id, (chat) => {
|
|
30208
|
+
if (update.unreadCount > 0) {
|
|
30209
|
+
update = { ...update };
|
|
30210
|
+
update.unreadCount = (chat.unreadCount || 0) + update.unreadCount;
|
|
30211
|
+
}
|
|
30212
|
+
Object.assign(chat, update);
|
|
30213
|
+
});
|
|
30214
|
+
if (!result) {
|
|
30215
|
+
logger.debug({ update }, 'got update for non-existant chat');
|
|
30216
|
+
}
|
|
30217
|
+
}
|
|
30218
|
+
});
|
|
30219
|
+
// ev.on('labels.edit', (label: Label) => {
|
|
30220
|
+
// if (label.deleted) {
|
|
30221
|
+
// return labels.deleteById(label.id)
|
|
30222
|
+
// }
|
|
30223
|
+
// // WhatsApp can store only up to 20 labels
|
|
30224
|
+
// if (labels.count() < 20) {
|
|
30225
|
+
// return labels.upsertById(label.id, label)
|
|
30226
|
+
// }
|
|
30227
|
+
// logger.error('Labels count exceed')
|
|
30228
|
+
// })
|
|
30229
|
+
// ev.on('labels.association', ({ type, association }) => {
|
|
30230
|
+
// switch (type) {
|
|
30231
|
+
// case 'add':
|
|
30232
|
+
// labelAssociations.upsert(association)
|
|
30233
|
+
// break
|
|
30234
|
+
// case 'remove':
|
|
30235
|
+
// labelAssociations.delete(association)
|
|
30236
|
+
// break
|
|
30237
|
+
// default:
|
|
30238
|
+
// console.error(`unknown operation type [${type}]`)
|
|
30239
|
+
// }
|
|
30240
|
+
// })
|
|
30241
|
+
ev.on('presence.update', ({ id, presences: update }) => {
|
|
30242
|
+
presences[id] = presences[id] || {};
|
|
30243
|
+
Object.assign(presences[id], update);
|
|
30244
|
+
});
|
|
30245
|
+
// ev.on('chats.delete', deletions => {
|
|
30246
|
+
// for (const item of deletions) {
|
|
30247
|
+
// if (chats.get(item)) {
|
|
30248
|
+
// chats.deleteById(item)
|
|
30249
|
+
// }
|
|
30250
|
+
// }
|
|
30251
|
+
// })
|
|
30252
|
+
ev.on('messages.upsert', ({ messages: newMessages, type }) => {
|
|
30253
|
+
switch (type) {
|
|
30254
|
+
case 'append':
|
|
30255
|
+
case 'notify':
|
|
30256
|
+
for (const msg of newMessages) {
|
|
30257
|
+
const jid = baileys.jidNormalizedUser(msg.key.remoteJid);
|
|
30258
|
+
const list = assertMessageList(jid);
|
|
30259
|
+
list.upsert(msg, 'append');
|
|
30260
|
+
if (type === 'notify') {
|
|
30261
|
+
if (!chats.get(jid)) {
|
|
30262
|
+
ev.emit('chats.upsert', [
|
|
30263
|
+
{
|
|
30264
|
+
id: jid,
|
|
30265
|
+
conversationTimestamp: baileys.toNumber(msg.messageTimestamp),
|
|
30266
|
+
unreadCount: 1,
|
|
30267
|
+
},
|
|
30268
|
+
]);
|
|
30269
|
+
}
|
|
30270
|
+
}
|
|
30271
|
+
}
|
|
30272
|
+
break;
|
|
30273
|
+
}
|
|
30274
|
+
});
|
|
30275
|
+
// ev.on('messages.update', updates => {
|
|
30276
|
+
// for (const { update, key } of updates) {
|
|
30277
|
+
// const list = assertMessageList(jidNormalizedUser(key.remoteJid!))
|
|
30278
|
+
// if (update?.status) {
|
|
30279
|
+
// const listStatus = list.get(key.id!)?.status
|
|
30280
|
+
// if (listStatus && update?.status <= listStatus) {
|
|
30281
|
+
// logger.debug({ update, storedStatus: listStatus }, 'status stored newer then update')
|
|
30282
|
+
// delete update.status
|
|
30283
|
+
// logger.debug({ update }, 'new update object')
|
|
30284
|
+
// }
|
|
30285
|
+
// }
|
|
30286
|
+
// const result = list.updateAssign(key.id!, update)
|
|
30287
|
+
// if (!result) {
|
|
30288
|
+
// logger.debug({ update }, 'got update for non-existent message')
|
|
30289
|
+
// }
|
|
30290
|
+
// }
|
|
30291
|
+
// })
|
|
30292
|
+
// ev.on('messages.delete', item => {
|
|
30293
|
+
// if ('all' in item) {
|
|
30294
|
+
// const list = messages[item.jid]
|
|
30295
|
+
// list?.clear()
|
|
30296
|
+
// } else {
|
|
30297
|
+
// const jid = item.keys[0].remoteJid!
|
|
30298
|
+
// const list = messages[jid]
|
|
30299
|
+
// if (list) {
|
|
30300
|
+
// const idSet = new Set(item.keys.map(k => k.id))
|
|
30301
|
+
// list.filter(m => !idSet.has(m.key.id))
|
|
30302
|
+
// }
|
|
30303
|
+
// }
|
|
30304
|
+
// })
|
|
30305
|
+
// ev.on('groups.update', updates => {
|
|
30306
|
+
// for (const update of updates) {
|
|
30307
|
+
// const id = update.id!
|
|
30308
|
+
// if (groupMetadata[id]) {
|
|
30309
|
+
// Object.assign(groupMetadata[id], update)
|
|
30310
|
+
// } else {
|
|
30311
|
+
// logger.debug({ update }, 'got update for non-existant group metadata')
|
|
30312
|
+
// }
|
|
30313
|
+
// }
|
|
30314
|
+
// })
|
|
30315
|
+
// ev.on('group-participants.update', ({ id, participants, action }) => {
|
|
30316
|
+
// const metadata = groupMetadata[id]
|
|
30317
|
+
// if (metadata) {
|
|
30318
|
+
// switch (action) {
|
|
30319
|
+
// case 'add':
|
|
30320
|
+
// metadata.participants.push(...participants.map(id => ({ id, isAdmin: false, isSuperAdmin: false })))
|
|
30321
|
+
// break
|
|
30322
|
+
// case 'demote':
|
|
30323
|
+
// case 'promote':
|
|
30324
|
+
// for (const participant of metadata.participants) {
|
|
30325
|
+
// if (participants.includes(participant.id)) {
|
|
30326
|
+
// participant.isAdmin = action === 'promote'
|
|
30327
|
+
// }
|
|
30328
|
+
// }
|
|
30329
|
+
// break
|
|
30330
|
+
// case 'remove':
|
|
30331
|
+
// metadata.participants = metadata.participants.filter(p => !participants.includes(p.id))
|
|
30332
|
+
// break
|
|
30333
|
+
// }
|
|
30334
|
+
// }
|
|
30335
|
+
// })
|
|
30336
|
+
// ev.on('message-receipt.update', updates => {
|
|
30337
|
+
// for (const { key, receipt } of updates) {
|
|
30338
|
+
// const obj = messages[key.remoteJid!]
|
|
30339
|
+
// const msg = obj?.get(key.id!)
|
|
30340
|
+
// if (msg) {
|
|
30341
|
+
// updateMessageWithReceipt(msg, receipt)
|
|
30342
|
+
// }
|
|
30343
|
+
// }
|
|
30344
|
+
// })
|
|
30345
|
+
// ev.on('messages.reaction', (reactions) => {
|
|
30346
|
+
// for (const { key, reaction } of reactions) {
|
|
30347
|
+
// const obj = messages[key.remoteJid!]
|
|
30348
|
+
// const msg = obj?.get(key.id!)
|
|
30349
|
+
// if (msg) {
|
|
30350
|
+
// updateMessageWithReaction(msg, reaction)
|
|
30351
|
+
// }
|
|
30352
|
+
// }
|
|
30353
|
+
// })
|
|
30354
|
+
};
|
|
30355
|
+
const toJSON = () => ({
|
|
30356
|
+
chats,
|
|
30357
|
+
contacts,
|
|
30358
|
+
messages,
|
|
30359
|
+
labels,
|
|
30360
|
+
labelAssociations,
|
|
30361
|
+
});
|
|
30362
|
+
const fromJSON = (json) => {
|
|
30363
|
+
chats.upsert(...json.chats);
|
|
30364
|
+
labelAssociations.upsert(...(json.labelAssociations || []));
|
|
30365
|
+
contactsUpsert(Object.values(json.contacts));
|
|
30366
|
+
labelsUpsert(Object.values(json.labels || {}));
|
|
30367
|
+
for (const jid in json.messages) {
|
|
30368
|
+
const list = assertMessageList(jid);
|
|
30369
|
+
for (const msg of json.messages[jid]) {
|
|
30370
|
+
list.upsert(baileys.proto.WebMessageInfo.fromObject(msg), 'append');
|
|
30371
|
+
}
|
|
30372
|
+
}
|
|
30373
|
+
};
|
|
30374
|
+
return {
|
|
30375
|
+
chats,
|
|
30376
|
+
contacts,
|
|
30377
|
+
messages,
|
|
30378
|
+
groupMetadata,
|
|
30379
|
+
state,
|
|
30380
|
+
presences,
|
|
30381
|
+
labels,
|
|
30382
|
+
labelAssociations,
|
|
30383
|
+
bind,
|
|
30384
|
+
/** loads messages from the store, if not found -- uses the legacy connection */
|
|
30385
|
+
loadMessages: async (jid, count, cursor) => {
|
|
30386
|
+
const list = assertMessageList(jid);
|
|
30387
|
+
const mode = !cursor || 'before' in cursor ? 'before' : 'after';
|
|
30388
|
+
const cursorKey = cursor ? ('before' in cursor ? cursor.before : cursor.after) : undefined;
|
|
30389
|
+
const cursorValue = cursorKey ? list.get(cursorKey.id) : undefined;
|
|
30390
|
+
let messages;
|
|
30391
|
+
if (list && mode === 'before' && (!cursorKey || cursorValue)) {
|
|
30392
|
+
if (cursorValue) {
|
|
30393
|
+
const msgIdx = list.array.findIndex((m) => m.key.id === cursorKey?.id);
|
|
30394
|
+
messages = list.array.slice(0, msgIdx);
|
|
30395
|
+
}
|
|
30396
|
+
else {
|
|
30397
|
+
messages = list.array;
|
|
30398
|
+
}
|
|
30399
|
+
const diff = count - messages.length;
|
|
30400
|
+
if (diff < 0) {
|
|
30401
|
+
messages = messages.slice(-count); // get the last X messages
|
|
30402
|
+
}
|
|
30403
|
+
}
|
|
30404
|
+
else {
|
|
30405
|
+
messages = [];
|
|
30406
|
+
}
|
|
30407
|
+
return messages;
|
|
30408
|
+
},
|
|
30409
|
+
/**
|
|
30410
|
+
* Get all available labels for profile
|
|
30411
|
+
*
|
|
30412
|
+
* Keep in mind that the list is formed from predefined tags and tags
|
|
30413
|
+
* that were "caught" during their editing.
|
|
30414
|
+
*/
|
|
30415
|
+
getLabels: () => {
|
|
30416
|
+
return labels;
|
|
30417
|
+
},
|
|
30418
|
+
/**
|
|
30419
|
+
* Get labels for chat
|
|
30420
|
+
*
|
|
30421
|
+
* @returns Label IDs
|
|
30422
|
+
**/
|
|
30423
|
+
getChatLabels: (chatId) => {
|
|
30424
|
+
return labelAssociations.filter((la) => la.chatId === chatId).all();
|
|
30425
|
+
},
|
|
30426
|
+
/**
|
|
30427
|
+
* Get labels for message
|
|
30428
|
+
*
|
|
30429
|
+
* @returns Label IDs
|
|
30430
|
+
**/
|
|
30431
|
+
getMessageLabels: (messageId) => {
|
|
30432
|
+
const associations = labelAssociations
|
|
30433
|
+
.filter((la) => la.messageId === messageId)
|
|
30434
|
+
.all();
|
|
30435
|
+
return associations.map(({ labelId }) => labelId);
|
|
30436
|
+
},
|
|
30437
|
+
loadMessage: async (jid, id) => messages[jid]?.get(id),
|
|
30438
|
+
mostRecentMessage: async (jid) => {
|
|
30439
|
+
const message = messages[jid]?.array.slice(-1)[0];
|
|
30440
|
+
return message;
|
|
30441
|
+
},
|
|
30442
|
+
fetchImageUrl: async (jid, sock) => {
|
|
30443
|
+
const contact = contacts[jid];
|
|
30444
|
+
if (!contact) {
|
|
30445
|
+
return sock?.profilePictureUrl(jid);
|
|
30446
|
+
}
|
|
30447
|
+
if (typeof contact.imgUrl === 'undefined') {
|
|
30448
|
+
contact.imgUrl = await sock?.profilePictureUrl(jid);
|
|
30449
|
+
}
|
|
30450
|
+
return contact.imgUrl;
|
|
30451
|
+
},
|
|
30452
|
+
fetchGroupMetadata: async (jid, sock) => {
|
|
30453
|
+
if (!groupMetadata[jid]) {
|
|
30454
|
+
const metadata = await sock?.groupMetadata(jid);
|
|
30455
|
+
if (metadata) {
|
|
30456
|
+
groupMetadata[jid] = metadata;
|
|
30457
|
+
}
|
|
30458
|
+
}
|
|
30459
|
+
return groupMetadata[jid];
|
|
30460
|
+
},
|
|
30461
|
+
// fetchBroadcastListInfo: async(jid: string, sock: WASocket | undefined) => {
|
|
30462
|
+
// if(!groupMetadata[jid]) {
|
|
30463
|
+
// const metadata = await sock?.getBroadcastListInfo(jid)
|
|
30464
|
+
// if(metadata) {
|
|
30465
|
+
// groupMetadata[jid] = metadata
|
|
30466
|
+
// }
|
|
30467
|
+
// }
|
|
30468
|
+
// return groupMetadata[jid]
|
|
30469
|
+
// },
|
|
30470
|
+
fetchMessageReceipts: async ({ remoteJid, id }) => {
|
|
30471
|
+
const list = messages[remoteJid];
|
|
30472
|
+
const msg = list?.get(id);
|
|
30473
|
+
return msg?.userReceipt;
|
|
30474
|
+
},
|
|
30475
|
+
toJSON,
|
|
30476
|
+
fromJSON,
|
|
30477
|
+
writeToFile: (path) => {
|
|
30478
|
+
// require fs here so that in case "fs" is not available -- the app does not crash
|
|
30479
|
+
const { writeFileSync } = require('fs');
|
|
30480
|
+
writeFileSync(path, JSON.stringify(toJSON()));
|
|
30481
|
+
},
|
|
30482
|
+
readFromFile: (path) => {
|
|
30483
|
+
// require fs here so that in case "fs" is not available -- the app does not crash
|
|
30484
|
+
const { readFileSync, existsSync } = require('fs');
|
|
30485
|
+
if (existsSync(path)) {
|
|
30486
|
+
logger.debug({ path }, 'reading from file');
|
|
30487
|
+
const jsonStr = readFileSync(path, { encoding: 'utf-8' });
|
|
30488
|
+
const json = JSON.parse(jsonStr);
|
|
30489
|
+
fromJSON(json);
|
|
30490
|
+
}
|
|
30491
|
+
},
|
|
30492
|
+
};
|
|
30493
|
+
};
|
|
30494
|
+
|
|
30011
30495
|
const keepFiles = ['creds.json', 'baileys_store.json', 'app-state-sync', 'session'];
|
|
30012
30496
|
/**
|
|
30013
30497
|
* @alpha
|
|
@@ -30057,6 +30541,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30057
30541
|
port: 3000,
|
|
30058
30542
|
timeRelease: 0, //21600000
|
|
30059
30543
|
writeMyself: 'none',
|
|
30544
|
+
experimentalStore: false,
|
|
30060
30545
|
};
|
|
30061
30546
|
this.idsDuplicates = [];
|
|
30062
30547
|
this.indexHome = (req, res) => {
|
|
@@ -30085,7 +30570,9 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30085
30570
|
this.saveCredsGlobal = saveCreds;
|
|
30086
30571
|
try {
|
|
30087
30572
|
if (this.globalVendorArgs.useBaileysStore) {
|
|
30088
|
-
this.store =
|
|
30573
|
+
this.store = !this.globalVendorArgs.experimentalStore
|
|
30574
|
+
? baileys.makeInMemoryStore({ logger: loggerBaileys })
|
|
30575
|
+
: bindStore({ logger: loggerBaileys });
|
|
30089
30576
|
if (this.store?.readFromFile)
|
|
30090
30577
|
this.store?.readFromFile(`${NAME_DIR_SESSION}/baileys_store.json`);
|
|
30091
30578
|
setInterval(() => {
|
|
@@ -30118,7 +30605,8 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30118
30605
|
getMessage: this.getMessage,
|
|
30119
30606
|
...this.globalVendorArgs,
|
|
30120
30607
|
});
|
|
30121
|
-
this
|
|
30608
|
+
if (this?.store)
|
|
30609
|
+
this.store.bind(sock.ev);
|
|
30122
30610
|
this.vendor = sock;
|
|
30123
30611
|
if (this.globalVendorArgs.usePairingCode && !sock.authState.creds.registered) {
|
|
30124
30612
|
if (this.globalVendorArgs.phoneNumber) {
|
|
@@ -30250,7 +30738,7 @@ class BaileysProvider extends bot.ProviderClass {
|
|
|
30250
30738
|
payload = { ...payload, body: bot.utils.generateRefProvider('_event_media_') };
|
|
30251
30739
|
}
|
|
30252
30740
|
//Detectar file
|
|
30253
|
-
if (messageCtx.message?.documentMessage) {
|
|
30741
|
+
if (messageCtx.message?.documentMessage || messageCtx.message?.documentWithCaptionMessage) {
|
|
30254
30742
|
payload = { ...payload, body: bot.utils.generateRefProvider('_event_document_') };
|
|
30255
30743
|
}
|
|
30256
30744
|
//Detectar voice note
|
package/dist/type.d.ts
CHANGED
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAElE,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC5D,WAAW,EAAE,OAAO,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,GAAG,CAAA;CACb"}
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAElE,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC5D,WAAW,EAAE,OAAO,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,GAAG,CAAA;CACb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builderbot/provider-baileys",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8-alpha.0",
|
|
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.1.
|
|
33
|
+
"@builderbot/bot": "^1.1.8-alpha.0",
|
|
34
34
|
"@hapi/boom": "^10.0.1",
|
|
35
35
|
"@jest/globals": "^29.7.0",
|
|
36
36
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -58,11 +58,12 @@
|
|
|
58
58
|
"wtfnode": "^0.9.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
+
"@adiwajshing/keyed-db": "^0.2.4",
|
|
61
62
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
62
63
|
"@types/polka": "^0.5.7",
|
|
63
|
-
"@whiskeysockets/baileys": "~6.
|
|
64
|
+
"@whiskeysockets/baileys": "~6.7.5",
|
|
64
65
|
"fluent-ffmpeg": "^2.1.2",
|
|
65
66
|
"fs-extra": "^11.2.0"
|
|
66
67
|
},
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "0295160bebfd4d063dcbff8a36cf3a394cf9f3c9"
|
|
68
69
|
}
|