@genuxofficial/baileys 2.0.0 → 4.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/WAProto/WAProto.proto +4451 -0
- package/WAProto/index.d.ts +219 -2233
- package/WAProto/index.js +525 -6773
- package/WAProto/shizo.x +1 -0
- package/engine-requirements.js +1 -1
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +236 -3
- package/lib/Defaults/index.js +24 -8
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/libsignal.js +9 -18
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +2 -0
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.js +3 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
- package/lib/Socket/Client/{websocket.js → web-socket-client.js} +3 -3
- package/lib/Socket/business.d.ts +43 -43
- package/lib/Socket/chats.d.ts +17 -23
- package/lib/Socket/chats.js +9 -123
- package/lib/Socket/groups.d.ts +27 -32
- package/lib/Socket/groups.js +5 -18
- package/lib/Socket/index.d.ts +51 -49
- package/lib/Socket/index.js +2 -2
- package/lib/Socket/messages-recv.d.ts +41 -42
- package/lib/Socket/messages-recv.js +20 -39
- package/lib/Socket/messages-send.d.ts +33 -38
- package/lib/Socket/messages-send.js +16 -37
- package/lib/Socket/newsletter.d.ts +30 -35
- package/lib/Socket/newsletter.js +22 -26
- package/lib/Socket/registration.d.ts +271 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +10 -9
- package/lib/Socket/socket.js +19 -16
- package/lib/Socket/usync.d.ts +12 -10
- package/lib/Socket/usync.js +15 -10
- package/lib/Store/index.d.ts +2 -1
- package/lib/Store/index.js +3 -1
- package/lib/Store/make-in-memory-store.d.ts +1 -1
- package/lib/Store/make-in-memory-store.js +10 -8
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +8 -0
- package/lib/Types/Chat.d.ts +2 -12
- package/lib/Types/Contact.d.ts +1 -6
- package/lib/Types/GroupMetadata.d.ts +0 -7
- package/lib/Types/Label.d.ts +0 -11
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +8 -7
- package/lib/Types/Message.js +2 -0
- package/lib/Types/Newsletter.js +2 -2
- package/lib/Types/Socket.d.ts +6 -7
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.d.ts +1 -1
- package/lib/Utils/auth-utils.js +12 -5
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +13 -11
- package/lib/Utils/chat-utils.js +2 -28
- package/lib/Utils/crypto.d.ts +16 -14
- package/lib/Utils/crypto.js +22 -34
- package/lib/Utils/decode-wa-message.d.ts +2 -4
- package/lib/Utils/decode-wa-message.js +24 -160
- package/lib/Utils/event-buffer.js +6 -4
- package/lib/Utils/generics.d.ts +12 -40
- package/lib/Utils/generics.js +25 -103
- package/lib/Utils/link-preview.js +1 -34
- package/lib/Utils/lt-hash.d.ts +3 -3
- package/lib/Utils/lt-hash.js +45 -11
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +16 -26
- package/lib/Utils/messages-media.js +26 -102
- package/lib/Utils/messages.d.ts +8 -5
- package/lib/Utils/messages.js +15 -17
- package/lib/Utils/noise-handler.d.ts +8 -5
- package/lib/Utils/noise-handler.js +10 -5
- package/lib/Utils/process-message.js +2 -2
- package/lib/Utils/use-multi-file-auth-state.js +11 -48
- package/lib/Utils/validate-connection.d.ts +3 -2
- package/lib/Utils/validate-connection.js +44 -10
- package/lib/WABinary/constants.js +5 -5
- package/lib/WABinary/decode.d.ts +4 -2
- package/lib/WABinary/decode.js +7 -17
- package/lib/WABinary/encode.d.ts +3 -1
- package/lib/WABinary/encode.js +17 -40
- package/lib/WABinary/generic-utils.d.ts +3 -1
- package/lib/WABinary/generic-utils.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +3 -8
- package/lib/WABinary/jid-utils.js +2 -23
- package/lib/WAM/BinaryInfo.d.ts +12 -2
- package/lib/WAM/constants.d.ts +2 -3
- package/lib/WAM/encode.d.ts +3 -1
- package/lib/WAM/encode.js +2 -2
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +2 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +5 -5
- package/lib/WAUSync/USyncQuery.d.ts +0 -2
- package/lib/WAUSync/USyncQuery.js +13 -27
- package/lib/WAUSync/USyncUser.d.ts +0 -2
- package/lib/WAUSync/USyncUser.js +0 -4
- package/package.json +60 -55
- package/LICENSE +0 -21
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -53
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -24
- /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -9,20 +9,20 @@ class USyncStatusProtocol {
|
|
9
9
|
getQueryElement() {
|
10
10
|
return {
|
11
11
|
tag: 'status',
|
12
|
-
attrs: {}
|
12
|
+
attrs: {},
|
13
13
|
};
|
14
14
|
}
|
15
15
|
getUserElement() {
|
16
16
|
return null;
|
17
17
|
}
|
18
18
|
parser(node) {
|
19
|
-
var _a
|
19
|
+
var _a;
|
20
20
|
if (node.tag === 'status') {
|
21
21
|
(0, WABinary_1.assertNodeErrorFree)(node);
|
22
|
-
let status =
|
22
|
+
let status = node === null || node === void 0 ? void 0 : node.content.toString();
|
23
23
|
const setAt = new Date(+((node === null || node === void 0 ? void 0 : node.attrs.t) || 0) * 1000);
|
24
24
|
if (!status) {
|
25
|
-
if (+((
|
25
|
+
if (+((_a = node.attrs) === null || _a === void 0 ? void 0 : _a.code) === 401) {
|
26
26
|
status = '';
|
27
27
|
}
|
28
28
|
else {
|
@@ -34,7 +34,7 @@ class USyncStatusProtocol {
|
|
34
34
|
}
|
35
35
|
return {
|
36
36
|
status,
|
37
|
-
setAt
|
37
|
+
setAt,
|
38
38
|
};
|
39
39
|
}
|
40
40
|
}
|
@@ -2,8 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.USyncQuery = void 0;
|
4
4
|
const WABinary_1 = require("../WABinary");
|
5
|
-
const UsyncBotProfileProtocol_1 = require("./Protocols/UsyncBotProfileProtocol");
|
6
|
-
const UsyncLIDProtocol_1 = require("./Protocols/UsyncLIDProtocol");
|
7
5
|
const Protocols_1 = require("./Protocols");
|
8
6
|
class USyncQuery {
|
9
7
|
constructor() {
|
@@ -28,13 +26,13 @@ class USyncQuery {
|
|
28
26
|
if (result.attrs.type !== 'result') {
|
29
27
|
return;
|
30
28
|
}
|
31
|
-
const protocolMap = Object.fromEntries(this.protocols.map(protocol => {
|
29
|
+
const protocolMap = Object.fromEntries(this.protocols.map((protocol) => {
|
32
30
|
return [protocol.name, protocol.parser];
|
33
31
|
}));
|
34
32
|
const queryResult = {
|
35
33
|
// TODO: implement errors etc.
|
36
34
|
list: [],
|
37
|
-
sideList: []
|
35
|
+
sideList: [],
|
38
36
|
};
|
39
37
|
const usyncNode = (0, WABinary_1.getBinaryNodeChild)(result, 'usync');
|
40
38
|
//TODO: implement error backoff, refresh etc.
|
@@ -42,22 +40,18 @@ class USyncQuery {
|
|
42
40
|
//const resultNode = getBinaryNodeChild(usyncNode, 'result')
|
43
41
|
const listNode = (0, WABinary_1.getBinaryNodeChild)(usyncNode, 'list');
|
44
42
|
if (Array.isArray(listNode === null || listNode === void 0 ? void 0 : listNode.content) && typeof listNode !== 'undefined') {
|
45
|
-
queryResult.list = listNode.content.map(node => {
|
43
|
+
queryResult.list = listNode.content.map((node) => {
|
46
44
|
const id = node === null || node === void 0 ? void 0 : node.attrs.jid;
|
47
|
-
const data = Array.isArray(node === null || node === void 0 ? void 0 : node.content)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
58
|
-
})
|
59
|
-
.filter(([, b]) => b !== null))
|
60
|
-
: {};
|
45
|
+
const data = Array.isArray(node === null || node === void 0 ? void 0 : node.content) ? Object.fromEntries(node.content.map((content) => {
|
46
|
+
const protocol = content.tag;
|
47
|
+
const parser = protocolMap[protocol];
|
48
|
+
if (parser) {
|
49
|
+
return [protocol, parser(content)];
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
return [protocol, null];
|
53
|
+
}
|
54
|
+
}).filter(([, b]) => b !== null)) : {};
|
61
55
|
return { ...data, id };
|
62
56
|
});
|
63
57
|
}
|
@@ -81,13 +75,5 @@ class USyncQuery {
|
|
81
75
|
this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol());
|
82
76
|
return this;
|
83
77
|
}
|
84
|
-
withBotProfileProtocol() {
|
85
|
-
this.protocols.push(new UsyncBotProfileProtocol_1.USyncBotProfileProtocol());
|
86
|
-
return this;
|
87
|
-
}
|
88
|
-
withLIDProtocol() {
|
89
|
-
this.protocols.push(new UsyncLIDProtocol_1.USyncLIDProtocol());
|
90
|
-
return this;
|
91
|
-
}
|
92
78
|
}
|
93
79
|
exports.USyncQuery = USyncQuery;
|
@@ -3,10 +3,8 @@ export declare class USyncUser {
|
|
3
3
|
lid: string;
|
4
4
|
phone: string;
|
5
5
|
type: string;
|
6
|
-
personaId: string;
|
7
6
|
withId(id: string): this;
|
8
7
|
withLid(lid: string): this;
|
9
8
|
withPhone(phone: string): this;
|
10
9
|
withType(type: string): this;
|
11
|
-
withPersonaId(personaId: string): this;
|
12
10
|
}
|
package/lib/WAUSync/USyncUser.js
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@genuxofficial/baileys",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
3
|
+
"version": "4.0.0",
|
4
|
+
"description": "WhatsApp API",
|
5
5
|
"keywords": [
|
6
6
|
"baileys",
|
7
7
|
"baileys-mod",
|
@@ -16,91 +16,96 @@
|
|
16
16
|
],
|
17
17
|
"homepage": "https://github.com/genux-official/Baileys",
|
18
18
|
"repository": {
|
19
|
-
"url": "
|
19
|
+
"url": "https://github.com/genux-official/Baileys.git"
|
20
20
|
},
|
21
21
|
"license": "MIT",
|
22
|
-
"author": "
|
22
|
+
"author": "Yugesh Singh",
|
23
23
|
"main": "lib/index.js",
|
24
24
|
"types": "lib/index.d.ts",
|
25
25
|
"files": [
|
26
26
|
"lib/*",
|
27
|
-
"WAProto
|
28
|
-
"WAProto/*.js",
|
27
|
+
"WAProto/*",
|
29
28
|
"WASignalGroup/*.js",
|
30
29
|
"engine-requirements.js"
|
31
30
|
],
|
31
|
+
"scripts": {
|
32
|
+
"build:all": "tsc && typedoc",
|
33
|
+
"build:docs": "typedoc",
|
34
|
+
"build:tsc": "tsc",
|
35
|
+
"changelog:last": "conventional-changelog -p angular -r 2",
|
36
|
+
"changelog:preview": "conventional-changelog -p angular -u",
|
37
|
+
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
38
|
+
"example": "node --inspect -r ts-node/register Example/example.ts",
|
39
|
+
"example:mobile": "node --inspect -r ts-node/register Example/example.ts --mobile",
|
40
|
+
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
41
|
+
"lint": "eslint src --ext .js,.ts,.jsx,.tsx",
|
42
|
+
"lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
|
43
|
+
"prepack": "tsc",
|
44
|
+
"prepare": "tsc",
|
45
|
+
"release": "release-it",
|
46
|
+
"test": "jest"
|
47
|
+
},
|
32
48
|
"dependencies": {
|
33
49
|
"@adiwajshing/keyed-db": "^0.2.4",
|
34
|
-
"@
|
35
|
-
"@queenanya/eslint-config": "github:whiskeysockets/eslint-config",
|
36
|
-
"@hapi/boom": "^10.0.1",
|
50
|
+
"@hapi/boom": "^9.1.3",
|
37
51
|
"async-lock": "^1.4.1",
|
38
|
-
"async-mutex": "^0.5.0",
|
39
52
|
"audio-decode": "^2.1.3",
|
40
|
-
"axios": "^1.
|
53
|
+
"axios": "^1.6.0",
|
41
54
|
"cache-manager": "^5.7.6",
|
42
|
-
"
|
55
|
+
"libphonenumber-js": "^1.10.20",
|
56
|
+
"libsignal": "https://github.com/shizo-devs/libsignal-node.git",
|
43
57
|
"lodash": "^4.17.21",
|
44
58
|
"music-metadata": "^7.12.3",
|
59
|
+
"@cacheable/node-cache": "^1.4.0",
|
45
60
|
"pino": "^9.6",
|
46
|
-
"protobufjs": "^
|
47
|
-
"
|
48
|
-
"ws": "^8.
|
61
|
+
"protobufjs": "^6.11.3",
|
62
|
+
"uuid": "^10.0.0",
|
63
|
+
"ws": "^8.13.0"
|
49
64
|
},
|
50
65
|
"devDependencies": {
|
51
|
-
"@
|
52
|
-
"@types/
|
53
|
-
"@types/
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
66
|
+
"@adiwajshing/eslint-config": "https://github.com/adiwajshing/eslint-config.git",
|
67
|
+
"@types/got": "^9.6.11",
|
68
|
+
"@types/jest": "^27.5.1",
|
69
|
+
"@types/node": "^16.0.0",
|
70
|
+
"@types/sharp": "^0.29.4",
|
71
|
+
"@types/ws": "^8.0.0",
|
72
|
+
"conventional-changelog-cli": "^2.2.2",
|
73
|
+
"eslint": "^8.0.0",
|
74
|
+
"jest": "^27.0.6",
|
75
|
+
"jimp": "^0.16.1",
|
58
76
|
"json": "^11.0.0",
|
59
|
-
"link-preview-js": "^3.0.
|
60
|
-
"open": "^
|
61
|
-
"
|
62
|
-
"release-it": "^
|
63
|
-
"sharp": "^0.
|
64
|
-
"ts-jest": "^
|
65
|
-
"ts-node": "^10.
|
66
|
-
"typedoc": "^0.
|
67
|
-
"
|
68
|
-
"typescript": "^5.8.2"
|
77
|
+
"link-preview-js": "^3.0.0",
|
78
|
+
"open": "^8.4.2",
|
79
|
+
"qrcode-terminal": "^0.12.0",
|
80
|
+
"release-it": "^15.10.3",
|
81
|
+
"sharp": "^0.32.6",
|
82
|
+
"ts-jest": "^27.0.3",
|
83
|
+
"ts-node": "^10.8.1",
|
84
|
+
"typedoc": "^0.24.7",
|
85
|
+
"typescript": "^4.6.4"
|
69
86
|
},
|
70
87
|
"peerDependencies": {
|
71
|
-
"
|
72
|
-
"
|
73
|
-
"link-preview-js": "^3.0.5",
|
88
|
+
"jimp": "^0.16.1",
|
89
|
+
"link-preview-js": "^3.0.0",
|
74
90
|
"qrcode-terminal": "^0.12.0",
|
75
|
-
"sharp": "^0.
|
91
|
+
"sharp": "^0.32.6"
|
76
92
|
},
|
77
93
|
"peerDependenciesMeta": {
|
78
|
-
"audio-decode": {
|
79
|
-
"optional": true
|
80
|
-
},
|
81
94
|
"jimp": {
|
82
95
|
"optional": true
|
83
96
|
},
|
84
97
|
"link-preview-js": {
|
85
98
|
"optional": true
|
86
99
|
},
|
100
|
+
"qrcode-terminal": {
|
101
|
+
"optional": true
|
102
|
+
},
|
87
103
|
"sharp": {
|
88
104
|
"optional": true
|
89
105
|
}
|
90
106
|
},
|
91
|
-
"
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
"changelog:preview": "conventional-changelog -p angular -u",
|
97
|
-
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
98
|
-
"example": "node --inspect -r ts-node/register Example/example.ts",
|
99
|
-
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
100
|
-
"lint": "eslint src --ext .js,.ts",
|
101
|
-
"lint:fix": "yarn lint --fix",
|
102
|
-
"preinstall": "node ./engine-requirements.js",
|
103
|
-
"release": "release-it",
|
104
|
-
"test": "jest"
|
105
|
-
}
|
106
|
-
}
|
107
|
+
"packageManager": "yarn@1.22.19",
|
108
|
+
"engines": {
|
109
|
+
"node": ">=20.0.0"
|
110
|
+
}
|
111
|
+
}
|
package/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
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.
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { USyncQueryProtocol } from '../../Types/USync';
|
2
|
-
import { BinaryNode } from '../../WABinary';
|
3
|
-
import { USyncUser } from '../USyncUser';
|
4
|
-
export type BotProfileCommand = {
|
5
|
-
name: string;
|
6
|
-
description: string;
|
7
|
-
};
|
8
|
-
export type BotProfileInfo = {
|
9
|
-
jid: string;
|
10
|
-
name: string;
|
11
|
-
attributes: string;
|
12
|
-
description: string;
|
13
|
-
category: string;
|
14
|
-
isDefault: boolean;
|
15
|
-
prompts: string[];
|
16
|
-
personaId: string;
|
17
|
-
commands: BotProfileCommand[];
|
18
|
-
commandsDescription: string;
|
19
|
-
};
|
20
|
-
export declare class USyncBotProfileProtocol implements USyncQueryProtocol {
|
21
|
-
name: string;
|
22
|
-
getQueryElement(): BinaryNode;
|
23
|
-
getUserElement(user: USyncUser): BinaryNode;
|
24
|
-
parser(node: BinaryNode): BotProfileInfo;
|
25
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.USyncBotProfileProtocol = void 0;
|
4
|
-
const WABinary_1 = require("../../WABinary");
|
5
|
-
class USyncBotProfileProtocol {
|
6
|
-
constructor() {
|
7
|
-
this.name = 'bot';
|
8
|
-
}
|
9
|
-
getQueryElement() {
|
10
|
-
return {
|
11
|
-
tag: 'bot',
|
12
|
-
attrs: {},
|
13
|
-
content: [{ tag: 'profile', attrs: { v: '1' } }]
|
14
|
-
};
|
15
|
-
}
|
16
|
-
getUserElement(user) {
|
17
|
-
return {
|
18
|
-
tag: 'bot',
|
19
|
-
attrs: {},
|
20
|
-
content: [{ tag: 'profile', attrs: { persona_id: user.personaId } }]
|
21
|
-
};
|
22
|
-
}
|
23
|
-
parser(node) {
|
24
|
-
const botNode = (0, WABinary_1.getBinaryNodeChild)(node, 'bot');
|
25
|
-
const profile = (0, WABinary_1.getBinaryNodeChild)(botNode, 'profile');
|
26
|
-
const commandsNode = (0, WABinary_1.getBinaryNodeChild)(profile, 'commands');
|
27
|
-
const promptsNode = (0, WABinary_1.getBinaryNodeChild)(profile, 'prompts');
|
28
|
-
const commands = [];
|
29
|
-
const prompts = [];
|
30
|
-
for (const command of (0, WABinary_1.getBinaryNodeChildren)(commandsNode, 'command')) {
|
31
|
-
commands.push({
|
32
|
-
name: (0, WABinary_1.getBinaryNodeChildString)(command, 'name'),
|
33
|
-
description: (0, WABinary_1.getBinaryNodeChildString)(command, 'description')
|
34
|
-
});
|
35
|
-
}
|
36
|
-
for (const prompt of (0, WABinary_1.getBinaryNodeChildren)(promptsNode, 'prompt')) {
|
37
|
-
prompts.push(`${(0, WABinary_1.getBinaryNodeChildString)(prompt, 'emoji')} ${(0, WABinary_1.getBinaryNodeChildString)(prompt, 'text')}`);
|
38
|
-
}
|
39
|
-
return {
|
40
|
-
isDefault: !!(0, WABinary_1.getBinaryNodeChild)(profile, 'default'),
|
41
|
-
jid: node.attrs.jid,
|
42
|
-
name: (0, WABinary_1.getBinaryNodeChildString)(profile, 'name'),
|
43
|
-
attributes: (0, WABinary_1.getBinaryNodeChildString)(profile, 'attributes'),
|
44
|
-
description: (0, WABinary_1.getBinaryNodeChildString)(profile, 'description'),
|
45
|
-
category: (0, WABinary_1.getBinaryNodeChildString)(profile, 'category'),
|
46
|
-
personaId: profile.attrs['persona_id'],
|
47
|
-
commandsDescription: (0, WABinary_1.getBinaryNodeChildString)(commandsNode, 'description'),
|
48
|
-
commands,
|
49
|
-
prompts
|
50
|
-
};
|
51
|
-
}
|
52
|
-
}
|
53
|
-
exports.USyncBotProfileProtocol = USyncBotProfileProtocol;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { USyncQueryProtocol } from '../../Types/USync';
|
2
|
-
import { BinaryNode } from '../../WABinary';
|
3
|
-
export declare class USyncLIDProtocol implements USyncQueryProtocol {
|
4
|
-
name: string;
|
5
|
-
getQueryElement(): BinaryNode;
|
6
|
-
getUserElement(): null;
|
7
|
-
parser(node: BinaryNode): string | null;
|
8
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.USyncLIDProtocol = void 0;
|
4
|
-
class USyncLIDProtocol {
|
5
|
-
constructor() {
|
6
|
-
this.name = 'lid';
|
7
|
-
}
|
8
|
-
getQueryElement() {
|
9
|
-
return {
|
10
|
-
tag: 'lid',
|
11
|
-
attrs: {}
|
12
|
-
};
|
13
|
-
}
|
14
|
-
getUserElement() {
|
15
|
-
return null;
|
16
|
-
}
|
17
|
-
parser(node) {
|
18
|
-
if (node.tag === 'lid') {
|
19
|
-
return node.attrs.val;
|
20
|
-
}
|
21
|
-
return null;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
exports.USyncLIDProtocol = USyncLIDProtocol;
|
File without changes
|