kashmiribailey 2.0.2 → 2.0.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/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Socket/Client/abstract-socket-client.d.ts +17 -0
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- 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/web-socket-client.d.ts +12 -0
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/dugong.d.ts +254 -0
- package/lib/Socket/dugong.js +1 -0
- package/lib/Socket/newsletter.js +1 -268
- package/lib/Socket/registration.d.ts +267 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Store/make-cache-manager-store.d.ts +13 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Utils/validate-connection.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
{
|
|
2
|
+
"93": 412,
|
|
3
|
+
"355": 276,
|
|
4
|
+
"213": 603,
|
|
5
|
+
"1-684": 544,
|
|
6
|
+
"376": 213,
|
|
7
|
+
"244": 631,
|
|
8
|
+
"1-264": 365,
|
|
9
|
+
"1-268": 344,
|
|
10
|
+
"54": 722,
|
|
11
|
+
"374": 283,
|
|
12
|
+
"297": 363,
|
|
13
|
+
"61": 505,
|
|
14
|
+
"43": 232,
|
|
15
|
+
"994": 400,
|
|
16
|
+
"1-242": 364,
|
|
17
|
+
"973": 426,
|
|
18
|
+
"880": 470,
|
|
19
|
+
"1-246": 342,
|
|
20
|
+
"375": 257,
|
|
21
|
+
"32": 206,
|
|
22
|
+
"501": 702,
|
|
23
|
+
"229": 616,
|
|
24
|
+
"1-441": 350,
|
|
25
|
+
"975": 402,
|
|
26
|
+
"591": 736,
|
|
27
|
+
"387": 218,
|
|
28
|
+
"267": 652,
|
|
29
|
+
"55": 724,
|
|
30
|
+
"1-284": 348,
|
|
31
|
+
"673": 528,
|
|
32
|
+
"359": 284,
|
|
33
|
+
"226": 613,
|
|
34
|
+
"257": 642,
|
|
35
|
+
"855": 456,
|
|
36
|
+
"237": 624,
|
|
37
|
+
"238": 625,
|
|
38
|
+
"1-345": 346,
|
|
39
|
+
"236": 623,
|
|
40
|
+
"235": 622,
|
|
41
|
+
"56": 730,
|
|
42
|
+
"86": 454,
|
|
43
|
+
"57": 732,
|
|
44
|
+
"269": 654,
|
|
45
|
+
"682": 548,
|
|
46
|
+
"506": 712,
|
|
47
|
+
"385": 219,
|
|
48
|
+
"53": 368,
|
|
49
|
+
"357": 280,
|
|
50
|
+
"420": 230,
|
|
51
|
+
"243": 630,
|
|
52
|
+
"45": 238,
|
|
53
|
+
"253": 638,
|
|
54
|
+
"1-767": 366,
|
|
55
|
+
"1-809": 370,
|
|
56
|
+
"1-849": 370,
|
|
57
|
+
"1-829": 370,
|
|
58
|
+
"593": 740,
|
|
59
|
+
"20": 602,
|
|
60
|
+
"503": 706,
|
|
61
|
+
"240": 627,
|
|
62
|
+
"291": 657,
|
|
63
|
+
"372": 248,
|
|
64
|
+
"251": 636,
|
|
65
|
+
"500": 750,
|
|
66
|
+
"298": 288,
|
|
67
|
+
"679": 542,
|
|
68
|
+
"358": 244,
|
|
69
|
+
"33": 208,
|
|
70
|
+
"689": 547,
|
|
71
|
+
"241": 628,
|
|
72
|
+
"220": 607,
|
|
73
|
+
"995": 282,
|
|
74
|
+
"49": 262,
|
|
75
|
+
"233": 620,
|
|
76
|
+
"350": 266,
|
|
77
|
+
"30": 202,
|
|
78
|
+
"299": 290,
|
|
79
|
+
"1-473": 352,
|
|
80
|
+
"1-671": 535,
|
|
81
|
+
"502": 704,
|
|
82
|
+
"224": 537,
|
|
83
|
+
"592": 738,
|
|
84
|
+
"509": 372,
|
|
85
|
+
"504": 708,
|
|
86
|
+
"852": 454,
|
|
87
|
+
"36": 216,
|
|
88
|
+
"354": 274,
|
|
89
|
+
"91": 404,
|
|
90
|
+
"62": 510,
|
|
91
|
+
"98": 432,
|
|
92
|
+
"964": 418,
|
|
93
|
+
"353": 234,
|
|
94
|
+
"972": 425,
|
|
95
|
+
"39": 222,
|
|
96
|
+
"225": 612,
|
|
97
|
+
"1-876": 338,
|
|
98
|
+
"81": 440,
|
|
99
|
+
"962": 416,
|
|
100
|
+
"254": 639,
|
|
101
|
+
"686": 545,
|
|
102
|
+
"383": 221,
|
|
103
|
+
"965": 419,
|
|
104
|
+
"371": 247,
|
|
105
|
+
"961": 415,
|
|
106
|
+
"266": 651,
|
|
107
|
+
"231": 618,
|
|
108
|
+
"218": 606,
|
|
109
|
+
"423": 295,
|
|
110
|
+
"370": 246,
|
|
111
|
+
"352": 270,
|
|
112
|
+
"389": 294,
|
|
113
|
+
"261": 646,
|
|
114
|
+
"265": 650,
|
|
115
|
+
"60": 502,
|
|
116
|
+
"960": 472,
|
|
117
|
+
"223": 610,
|
|
118
|
+
"356": 278,
|
|
119
|
+
"692": 551,
|
|
120
|
+
"222": 609,
|
|
121
|
+
"230": 617,
|
|
122
|
+
"52": 334,
|
|
123
|
+
"691": 550,
|
|
124
|
+
"373": 259,
|
|
125
|
+
"377": 212,
|
|
126
|
+
"976": 428,
|
|
127
|
+
"382": 297,
|
|
128
|
+
"1-664": 354,
|
|
129
|
+
"212": 604,
|
|
130
|
+
"258": 643,
|
|
131
|
+
"95": 414,
|
|
132
|
+
"264": 649,
|
|
133
|
+
"674": 536,
|
|
134
|
+
"977": 429,
|
|
135
|
+
"31": 204,
|
|
136
|
+
"687": 546,
|
|
137
|
+
"64": 530,
|
|
138
|
+
"505": 710,
|
|
139
|
+
"227": 614,
|
|
140
|
+
"234": 621,
|
|
141
|
+
"683": 555,
|
|
142
|
+
"1-670": 534,
|
|
143
|
+
"47": 242,
|
|
144
|
+
"968": 226,
|
|
145
|
+
"92": 410,
|
|
146
|
+
"680": 552,
|
|
147
|
+
"970": 423,
|
|
148
|
+
"507": 714,
|
|
149
|
+
"675": 537,
|
|
150
|
+
"595": 744,
|
|
151
|
+
"51": 716,
|
|
152
|
+
"63": 515,
|
|
153
|
+
"48": 260,
|
|
154
|
+
"351": 268,
|
|
155
|
+
"1-787, 1-939": 330,
|
|
156
|
+
"974": 427,
|
|
157
|
+
"242": 630,
|
|
158
|
+
"40": 226,
|
|
159
|
+
"7": 250,
|
|
160
|
+
"250": 635,
|
|
161
|
+
"290": 658,
|
|
162
|
+
"1-869": 356,
|
|
163
|
+
"1-758": 358,
|
|
164
|
+
"508": 308,
|
|
165
|
+
"1-784": 360,
|
|
166
|
+
"685": 544,
|
|
167
|
+
"378": 292,
|
|
168
|
+
"239": 626,
|
|
169
|
+
"966": 420,
|
|
170
|
+
"221": 608,
|
|
171
|
+
"381": 220,
|
|
172
|
+
"248": 633,
|
|
173
|
+
"232": 619,
|
|
174
|
+
"65": 525,
|
|
175
|
+
"386": 293,
|
|
176
|
+
"677": 540,
|
|
177
|
+
"27": 655,
|
|
178
|
+
"211": 659,
|
|
179
|
+
"34": 214,
|
|
180
|
+
"94": 413,
|
|
181
|
+
"249": 634,
|
|
182
|
+
"597": 746,
|
|
183
|
+
"268": 653,
|
|
184
|
+
"46": 240,
|
|
185
|
+
"41": 228,
|
|
186
|
+
"963": 417,
|
|
187
|
+
"886": 466,
|
|
188
|
+
"992": 436,
|
|
189
|
+
"255": 640,
|
|
190
|
+
"66": 520,
|
|
191
|
+
"228": 615,
|
|
192
|
+
"690": 554,
|
|
193
|
+
"676": 539,
|
|
194
|
+
"1-868": 374,
|
|
195
|
+
"216": 605,
|
|
196
|
+
"90": 286,
|
|
197
|
+
"993": 438,
|
|
198
|
+
"1-649": 376,
|
|
199
|
+
"688": 553,
|
|
200
|
+
"1-340": 332,
|
|
201
|
+
"256": 641,
|
|
202
|
+
"380": 255,
|
|
203
|
+
"971": 424,
|
|
204
|
+
"44": 234,
|
|
205
|
+
"1": 310,
|
|
206
|
+
"598": 748,
|
|
207
|
+
"998": 434,
|
|
208
|
+
"678": 541,
|
|
209
|
+
"379": 225,
|
|
210
|
+
"58": 734,
|
|
211
|
+
"681": 543,
|
|
212
|
+
"967": 421,
|
|
213
|
+
"260": 645,
|
|
214
|
+
"263": 648,
|
|
215
|
+
"670": 514,
|
|
216
|
+
"245": 632,
|
|
217
|
+
"856": 457,
|
|
218
|
+
"599": 362,
|
|
219
|
+
"850": 467,
|
|
220
|
+
"262": 647,
|
|
221
|
+
"82": 450,
|
|
222
|
+
"84": 452
|
|
223
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import { URL } from 'url';
|
|
5
|
+
import { SocketConfig } from '../../Types';
|
|
6
|
+
export declare abstract class AbstractSocketClient extends EventEmitter {
|
|
7
|
+
url: URL;
|
|
8
|
+
config: SocketConfig;
|
|
9
|
+
abstract get isOpen(): boolean;
|
|
10
|
+
abstract get isClosed(): boolean;
|
|
11
|
+
abstract get isClosing(): boolean;
|
|
12
|
+
abstract get isConnecting(): boolean;
|
|
13
|
+
constructor(url: URL, config: SocketConfig);
|
|
14
|
+
abstract connect(): Promise<void>;
|
|
15
|
+
abstract close(): Promise<void>;
|
|
16
|
+
abstract send(str: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractSocketClient = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
class AbstractSocketClient extends events_1.EventEmitter {
|
|
6
|
+
constructor(url, config) {
|
|
7
|
+
super();
|
|
8
|
+
this.url = url;
|
|
9
|
+
this.config = config;
|
|
10
|
+
this.setMaxListeners(0);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AbstractSocketClient = AbstractSocketClient;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Socket } from 'net';
|
|
3
|
+
import { AbstractSocketClient } from './abstract-socket-client';
|
|
4
|
+
export declare class MobileSocketClient extends AbstractSocketClient {
|
|
5
|
+
protected socket: Socket | null;
|
|
6
|
+
get isOpen(): boolean;
|
|
7
|
+
get isClosed(): boolean;
|
|
8
|
+
get isClosing(): boolean;
|
|
9
|
+
get isConnecting(): boolean;
|
|
10
|
+
connect(): Promise<void>;
|
|
11
|
+
close(): Promise<void>;
|
|
12
|
+
send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileSocketClient = void 0;
|
|
4
|
+
const net_1 = require("net");
|
|
5
|
+
const abstract_socket_client_1 = require("./abstract-socket-client");
|
|
6
|
+
class MobileSocketClient extends abstract_socket_client_1.AbstractSocketClient {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.socket = null;
|
|
10
|
+
}
|
|
11
|
+
get isOpen() {
|
|
12
|
+
var _a;
|
|
13
|
+
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'open';
|
|
14
|
+
}
|
|
15
|
+
get isClosed() {
|
|
16
|
+
var _a;
|
|
17
|
+
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
|
|
18
|
+
}
|
|
19
|
+
get isClosing() {
|
|
20
|
+
var _a;
|
|
21
|
+
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
|
|
22
|
+
}
|
|
23
|
+
get isConnecting() {
|
|
24
|
+
var _a;
|
|
25
|
+
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'opening';
|
|
26
|
+
}
|
|
27
|
+
async connect() {
|
|
28
|
+
var _a;
|
|
29
|
+
if (this.socket) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (this.config.agent) {
|
|
33
|
+
throw new Error('There are not support for proxy agent for mobile connection');
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.socket = (0, net_1.connect)({
|
|
37
|
+
host: this.url.hostname,
|
|
38
|
+
port: Number(this.url.port) || 443
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
this.socket.setMaxListeners(0);
|
|
42
|
+
const events = ['close', 'connect', 'data', 'drain', 'end', 'error', 'lookup', 'ready', 'timeout'];
|
|
43
|
+
for (const event of events) {
|
|
44
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.on(event, (...args) => this.emit(event, ...args));
|
|
45
|
+
}
|
|
46
|
+
this.socket.on('data', (...args) => this.emit('message', ...args));
|
|
47
|
+
this.socket.on('ready', (...args) => this.emit('open', ...args));
|
|
48
|
+
}
|
|
49
|
+
async close() {
|
|
50
|
+
if (!this.socket) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
return new Promise(resolve => {
|
|
54
|
+
this.socket.end(resolve);
|
|
55
|
+
this.socket = null;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
send(str, cb) {
|
|
59
|
+
if (this.socket === null) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return this.socket.write(str, undefined, cb);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.MobileSocketClient = MobileSocketClient;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import WebSocket from 'ws';
|
|
2
|
+
import { AbstractSocketClient } from './abstract-socket-client';
|
|
3
|
+
export declare class WebSocketClient extends AbstractSocketClient {
|
|
4
|
+
protected socket: WebSocket | null;
|
|
5
|
+
get isOpen(): boolean;
|
|
6
|
+
get isClosed(): boolean;
|
|
7
|
+
get isClosing(): boolean;
|
|
8
|
+
get isConnecting(): boolean;
|
|
9
|
+
connect(): Promise<void>;
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WebSocketClient = void 0;
|
|
7
|
+
const ws_1 = __importDefault(require("ws"));
|
|
8
|
+
const Defaults_1 = require("../../Defaults");
|
|
9
|
+
const abstract_socket_client_1 = require("./abstract-socket-client");
|
|
10
|
+
class WebSocketClient extends abstract_socket_client_1.AbstractSocketClient {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.socket = null;
|
|
14
|
+
}
|
|
15
|
+
get isOpen() {
|
|
16
|
+
var _a;
|
|
17
|
+
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === ws_1.default.OPEN;
|
|
18
|
+
}
|
|
19
|
+
get isClosed() {
|
|
20
|
+
var _a;
|
|
21
|
+
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === ws_1.default.CLOSED;
|
|
22
|
+
}
|
|
23
|
+
get isClosing() {
|
|
24
|
+
var _a;
|
|
25
|
+
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === ws_1.default.CLOSING;
|
|
26
|
+
}
|
|
27
|
+
get isConnecting() {
|
|
28
|
+
var _a;
|
|
29
|
+
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === ws_1.default.CONNECTING;
|
|
30
|
+
}
|
|
31
|
+
async connect() {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
if (this.socket) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this.socket = new ws_1.default(this.url, {
|
|
37
|
+
origin: Defaults_1.DEFAULT_ORIGIN,
|
|
38
|
+
headers: (_a = this.config.options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
39
|
+
handshakeTimeout: this.config.connectTimeoutMs,
|
|
40
|
+
timeout: this.config.connectTimeoutMs,
|
|
41
|
+
agent: this.config.agent,
|
|
42
|
+
});
|
|
43
|
+
this.socket.setMaxListeners(0);
|
|
44
|
+
const events = ['close', 'error', 'upgrade', 'message', 'open', 'ping', 'pong', 'unexpected-response'];
|
|
45
|
+
for (const event of events) {
|
|
46
|
+
(_b = this.socket) === null || _b === void 0 ? void 0 : _b.on(event, (...args) => this.emit(event, ...args));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async close() {
|
|
50
|
+
if (!this.socket) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.socket.close();
|
|
54
|
+
this.socket = null;
|
|
55
|
+
}
|
|
56
|
+
send(str, cb) {
|
|
57
|
+
var _a;
|
|
58
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.send(str, cb);
|
|
59
|
+
return Boolean(this.socket);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.WebSocketClient = WebSocketClient;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// dugong.d.ts
|
|
2
|
+
import { proto } from '../../WAProto';
|
|
3
|
+
|
|
4
|
+
declare namespace xeonDugong {
|
|
5
|
+
interface MediaUploadOptions {
|
|
6
|
+
fileEncSha256?: Buffer;
|
|
7
|
+
mediaType?: string;
|
|
8
|
+
newsletter?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type WAMediaUploadFunction = (
|
|
12
|
+
stream: Buffer | NodeJS.ReadableStream,
|
|
13
|
+
options?: MediaUploadOptions
|
|
14
|
+
) => Promise<{ url: string; directPath: string }>;
|
|
15
|
+
|
|
16
|
+
interface WAMessageContentGenerationOptions {
|
|
17
|
+
upload?: WAMediaUploadFunction;
|
|
18
|
+
mediaCache?: any;
|
|
19
|
+
options?: any;
|
|
20
|
+
logger?: any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface StickerMessage {
|
|
24
|
+
url: string;
|
|
25
|
+
fileSha256: Buffer | string;
|
|
26
|
+
fileEncSha256: Buffer | string;
|
|
27
|
+
mediaKey: Buffer | string;
|
|
28
|
+
mimetype: string;
|
|
29
|
+
directPath: string;
|
|
30
|
+
fileLength: number | string;
|
|
31
|
+
mediaKeyTimestamp: number | string;
|
|
32
|
+
isAnimated?: boolean;
|
|
33
|
+
stickerSentTs?: number | string;
|
|
34
|
+
isAvatar?: boolean;
|
|
35
|
+
isAiSticker?: boolean;
|
|
36
|
+
isLottie?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface PaymentMessage {
|
|
40
|
+
amount: number;
|
|
41
|
+
currency?: string;
|
|
42
|
+
from?: string;
|
|
43
|
+
expiry?: number;
|
|
44
|
+
sticker?: { stickerMessage: StickerMessage };
|
|
45
|
+
note?: string;
|
|
46
|
+
background?: {
|
|
47
|
+
id?: string;
|
|
48
|
+
fileLength?: string;
|
|
49
|
+
width?: number;
|
|
50
|
+
height?: number;
|
|
51
|
+
mimetype?: string;
|
|
52
|
+
placeholderArgb?: number;
|
|
53
|
+
textArgb?: number;
|
|
54
|
+
subtextArgb?: number;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface ProductMessage {
|
|
59
|
+
title: string;
|
|
60
|
+
description: string;
|
|
61
|
+
thumbnail: Buffer | { url: string };
|
|
62
|
+
productId: string;
|
|
63
|
+
retailerId: string;
|
|
64
|
+
url: string;
|
|
65
|
+
body?: string;
|
|
66
|
+
footer?: string;
|
|
67
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
68
|
+
priceAmount1000?: number | null;
|
|
69
|
+
currencyCode?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface InteractiveMessage {
|
|
73
|
+
header?: string;
|
|
74
|
+
title: string;
|
|
75
|
+
footer?: string;
|
|
76
|
+
thumbnail?: string;
|
|
77
|
+
image?: string | Buffer | { url: string };
|
|
78
|
+
video?: string | Buffer | { url: string };
|
|
79
|
+
document?: string | Buffer | { url: string };
|
|
80
|
+
mimetype?: string;
|
|
81
|
+
fileName?: string;
|
|
82
|
+
jpegThumbnail?: string | Buffer | { url: string };
|
|
83
|
+
contextInfo?: {
|
|
84
|
+
mentionedJid?: string[];
|
|
85
|
+
forwardingScore?: number;
|
|
86
|
+
isForwarded?: boolean;
|
|
87
|
+
externalAdReply?: {
|
|
88
|
+
title?: string;
|
|
89
|
+
body?: string;
|
|
90
|
+
mediaType?: number;
|
|
91
|
+
thumbnailUrl?: string;
|
|
92
|
+
mediaUrl?: string;
|
|
93
|
+
sourceUrl?: string;
|
|
94
|
+
showAdAttribution?: boolean;
|
|
95
|
+
renderLargerThumbnail?: boolean;
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
};
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
};
|
|
100
|
+
externalAdReply?: {
|
|
101
|
+
title?: string;
|
|
102
|
+
body?: string;
|
|
103
|
+
mediaType?: number;
|
|
104
|
+
thumbnailUrl?: string;
|
|
105
|
+
mediaUrl?: string;
|
|
106
|
+
sourceUrl?: string;
|
|
107
|
+
showAdAttribution?: boolean;
|
|
108
|
+
renderLargerThumbnail?: boolean;
|
|
109
|
+
[key: string]: any;
|
|
110
|
+
};
|
|
111
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
112
|
+
nativeFlowMessage?: {
|
|
113
|
+
messageParamsJson?: string;
|
|
114
|
+
buttons?: proto.Message.InteractiveMessage.INativeFlowButton[];
|
|
115
|
+
[key: string]: any;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface AlbumItem {
|
|
120
|
+
image?: string | Buffer | { url: string; caption?: string };
|
|
121
|
+
video?: string | Buffer | { url: string; caption?: string };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface EventMessageLocation {
|
|
125
|
+
degreesLatitude: number;
|
|
126
|
+
degreesLongitude: number;
|
|
127
|
+
name: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface EventMessage {
|
|
131
|
+
isCanceled?: boolean;
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
location?: EventMessageLocation;
|
|
135
|
+
joinLink?: string;
|
|
136
|
+
startTime?: string | number;
|
|
137
|
+
endTime?: string | number;
|
|
138
|
+
extraGuestsAllowed?: boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface PollVote {
|
|
142
|
+
optionName: string;
|
|
143
|
+
optionVoteCount: string | number;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface PollResultMessage {
|
|
147
|
+
name: string;
|
|
148
|
+
pollVotes: PollVote[];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface GroupStatusMessage {
|
|
152
|
+
message?: any;
|
|
153
|
+
image?: string | Buffer | { url: string };
|
|
154
|
+
video?: string | Buffer | { url: string };
|
|
155
|
+
text?: string;
|
|
156
|
+
caption?: string;
|
|
157
|
+
document?: string | Buffer | { url: string };
|
|
158
|
+
[key: string]: any;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface MessageContent {
|
|
162
|
+
requestPaymentMessage?: PaymentMessage;
|
|
163
|
+
productMessage?: ProductMessage;
|
|
164
|
+
interactiveMessage?: InteractiveMessage;
|
|
165
|
+
albumMessage?: AlbumItem[];
|
|
166
|
+
eventMessage?: EventMessage;
|
|
167
|
+
pollResultMessage?: PollResultMessage;
|
|
168
|
+
groupStatusMessage?: GroupStatusMessage;
|
|
169
|
+
sender?: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface MessageOptions {
|
|
173
|
+
quoted?: proto.IWebMessageInfo;
|
|
174
|
+
filter?: boolean;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
interface Utils {
|
|
178
|
+
prepareWAMessageMedia: (media: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
179
|
+
generateWAMessageContent: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
180
|
+
generateWAMessageFromContent: (jid: string, content: any, options?: any) => Promise<any>;
|
|
181
|
+
generateWAMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
182
|
+
generateMessageID: () => string;
|
|
183
|
+
prepareMessageContent?: (content: any, options?: any) => Promise<any>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface BailUtils {
|
|
187
|
+
generateWAMessageContent?: (content: any, options: WAMessageContentGenerationOptions) => Promise<any>;
|
|
188
|
+
generateMessageID: () => string;
|
|
189
|
+
getContentType: (msg: any) => string;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class xeonDugong {
|
|
194
|
+
constructor(
|
|
195
|
+
utils: xeonDugong.Utils,
|
|
196
|
+
waUploadToServer: xeonDugong.WAMediaUploadFunction,
|
|
197
|
+
relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
detectType(content: xeonDugong.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
|
|
201
|
+
|
|
202
|
+
handlePayment(
|
|
203
|
+
content: { requestPaymentMessage: xeonDugong.PaymentMessage },
|
|
204
|
+
quoted?: proto.IWebMessageInfo
|
|
205
|
+
): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
|
|
206
|
+
|
|
207
|
+
handleProduct(
|
|
208
|
+
content: { productMessage: xeonDugong.ProductMessage },
|
|
209
|
+
jid: string,
|
|
210
|
+
quoted?: proto.IWebMessageInfo
|
|
211
|
+
): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
|
|
212
|
+
|
|
213
|
+
handleInteractive(
|
|
214
|
+
content: { interactiveMessage: xeonDugong.InteractiveMessage },
|
|
215
|
+
jid: string,
|
|
216
|
+
quoted?: proto.IWebMessageInfo
|
|
217
|
+
): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
|
|
218
|
+
|
|
219
|
+
handleAlbum(
|
|
220
|
+
content: { albumMessage: xeonDugong.AlbumItem[] },
|
|
221
|
+
jid: string,
|
|
222
|
+
quoted?: proto.IWebMessageInfo
|
|
223
|
+
): Promise<any>;
|
|
224
|
+
|
|
225
|
+
handleEvent(
|
|
226
|
+
content: { eventMessage: xeonDugong.EventMessage },
|
|
227
|
+
jid: string,
|
|
228
|
+
quoted?: proto.IWebMessageInfo
|
|
229
|
+
): Promise<any>;
|
|
230
|
+
|
|
231
|
+
handlePollResult(
|
|
232
|
+
content: { pollResultMessage: xeonDugong.PollResultMessage },
|
|
233
|
+
jid: string,
|
|
234
|
+
quoted?: proto.IWebMessageInfo
|
|
235
|
+
): Promise<any>;
|
|
236
|
+
|
|
237
|
+
handleGroupStory(
|
|
238
|
+
content: { groupStatusMessage: xeonDugong.GroupStatusMessage },
|
|
239
|
+
jid: string,
|
|
240
|
+
quoted?: proto.IWebMessageInfo
|
|
241
|
+
): Promise<any>;
|
|
242
|
+
|
|
243
|
+
buildMessageContent(
|
|
244
|
+
content: any,
|
|
245
|
+
opts?: xeonDugong.WAMessageContentGenerationOptions
|
|
246
|
+
): Promise<any>;
|
|
247
|
+
|
|
248
|
+
utils: xeonDugong.Utils;
|
|
249
|
+
relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
|
|
250
|
+
waUploadToServer: xeonDugong.WAMediaUploadFunction;
|
|
251
|
+
bail: xeonDugong.BailUtils;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export = xeonDugong;
|