@open-wa/wa-automate 4.33.0 → 4.33.3
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/api/Client.d.ts +14 -1
- package/dist/api/Client.js +18 -2
- package/dist/api/model/events.d.ts +6 -1
- package/dist/api/model/events.js +5 -0
- package/dist/api/model/message.d.ts +2 -2
- package/dist/api/model/reactions.d.ts +76 -0
- package/dist/api/model/reactions.js +2 -0
- package/dist/controllers/initializer.js +5 -1
- package/dist/utils/tools.d.ts +0 -1
- package/dist/utils/tools.js +2 -2
- package/package.json +1 -1
package/dist/api/Client.d.ts
CHANGED
@@ -20,6 +20,7 @@ import { NextFunction, Request, Response } from 'express';
|
|
20
20
|
import { Call } from './model/call';
|
21
21
|
import { Button, Section } from './model/button';
|
22
22
|
import { JsonObject } from 'type-fest';
|
23
|
+
import { ReactionEvent } from './model/reactions';
|
23
24
|
export declare enum namespace {
|
24
25
|
Chat = "Chat",
|
25
26
|
Msg = "Msg",
|
@@ -231,6 +232,16 @@ export declare class Client {
|
|
231
232
|
* Listens to new orders. Only works on business accounts
|
232
233
|
*/
|
233
234
|
onNewProduct(fn: (product: Product) => void): Promise<Listener | boolean>;
|
235
|
+
/**
|
236
|
+
* [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
237
|
+
*
|
238
|
+
* Listens to reaction add and change events
|
239
|
+
*
|
240
|
+
* @event
|
241
|
+
* @param fn callback
|
242
|
+
* @fires [[ReactionEvent]]
|
243
|
+
*/
|
244
|
+
onReaction(fn: (reactionEvent: ReactionEvent) => void): Promise<Listener | boolean>;
|
234
245
|
/**
|
235
246
|
* [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
236
247
|
*
|
@@ -523,9 +534,11 @@ export declare class Client {
|
|
523
534
|
* @param groupId group chat id: `xxxxx@g.us`
|
524
535
|
* @param content text message to add under all of the tags
|
525
536
|
* @param hideTags Removes all tags within the message
|
537
|
+
* @param formatting The formatting of the tags. Use @mention to indicate the actual tag. @default `@mention `
|
538
|
+
* @param messageBeforeTags set to `true` to show the message before all of the tags
|
526
539
|
* @returns `Promise<MessageId>`
|
527
540
|
*/
|
528
|
-
tagEveryone(groupId: GroupChatId, content: Content, hideTags?: boolean): Promise<boolean | MessageId>;
|
541
|
+
tagEveryone(groupId: GroupChatId, content: Content, hideTags?: boolean, formatting?: string, messageBeforeTags?: boolean): Promise<boolean | MessageId>;
|
529
542
|
/**
|
530
543
|
* Sends a link to a chat that includes a link preview.
|
531
544
|
* @param thumb The base 64 data of the image you want to use as the thunbnail. This should be no more than 200x200px. Note: Dont need data url on this param
|
package/dist/api/Client.js
CHANGED
@@ -810,6 +810,20 @@ class Client {
|
|
810
810
|
return this.registerListener(events_2.SimpleListener.NewProduct, fn);
|
811
811
|
});
|
812
812
|
}
|
813
|
+
/**
|
814
|
+
* [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
815
|
+
*
|
816
|
+
* Listens to reaction add and change events
|
817
|
+
*
|
818
|
+
* @event
|
819
|
+
* @param fn callback
|
820
|
+
* @fires [[ReactionEvent]]
|
821
|
+
*/
|
822
|
+
onReaction(fn) {
|
823
|
+
return __awaiter(this, void 0, void 0, function* () {
|
824
|
+
return this.registerListener(events_2.SimpleListener.Reaction, fn);
|
825
|
+
});
|
826
|
+
}
|
813
827
|
/**
|
814
828
|
* [REQUIRES AN INSIDERS LICENSE-KEY](https://gum.co/open-wa?tier=Insiders%20Program)
|
815
829
|
*
|
@@ -1333,11 +1347,13 @@ class Client {
|
|
1333
1347
|
* @param groupId group chat id: `xxxxx@g.us`
|
1334
1348
|
* @param content text message to add under all of the tags
|
1335
1349
|
* @param hideTags Removes all tags within the message
|
1350
|
+
* @param formatting The formatting of the tags. Use @mention to indicate the actual tag. @default `@mention `
|
1351
|
+
* @param messageBeforeTags set to `true` to show the message before all of the tags
|
1336
1352
|
* @returns `Promise<MessageId>`
|
1337
1353
|
*/
|
1338
|
-
tagEveryone(groupId, content, hideTags) {
|
1354
|
+
tagEveryone(groupId, content, hideTags, formatting, messageBeforeTags) {
|
1339
1355
|
return __awaiter(this, void 0, void 0, function* () {
|
1340
|
-
return yield this.pup(({ groupId, content, hideTags }) => WAPI.tagEveryone(groupId, content, hideTags), { groupId, content, hideTags });
|
1356
|
+
return yield this.pup(({ groupId, content, hideTags, formatting, messageBeforeTags }) => WAPI.tagEveryone(groupId, content, hideTags, formatting, messageBeforeTags), { groupId, content, hideTags, formatting, messageBeforeTags });
|
1341
1357
|
});
|
1342
1358
|
}
|
1343
1359
|
/**
|
@@ -86,5 +86,10 @@ export declare enum SimpleListener {
|
|
86
86
|
* Requires licence
|
87
87
|
* Represents [[onNewProduct]]
|
88
88
|
*/
|
89
|
-
NewProduct = "onNewProduct"
|
89
|
+
NewProduct = "onNewProduct",
|
90
|
+
/**
|
91
|
+
* Requires licence
|
92
|
+
* Represents [[onReaction]]
|
93
|
+
*/
|
94
|
+
Reaction = "onReaction"
|
90
95
|
}
|
package/dist/api/model/events.js
CHANGED
@@ -94,4 +94,9 @@ var SimpleListener;
|
|
94
94
|
* Represents [[onNewProduct]]
|
95
95
|
*/
|
96
96
|
SimpleListener["NewProduct"] = "onNewProduct";
|
97
|
+
/**
|
98
|
+
* Requires licence
|
99
|
+
* Represents [[onReaction]]
|
100
|
+
*/
|
101
|
+
SimpleListener["Reaction"] = "onReaction";
|
97
102
|
})(SimpleListener = exports.SimpleListener || (exports.SimpleListener = {}));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ChatId, MessageId } from "./aliases";
|
1
|
+
import { ChatId, ContactId, MessageId } from "./aliases";
|
2
2
|
import { Button, Row, Section } from "./button";
|
3
3
|
import { Chat } from "./chat";
|
4
4
|
import { Contact } from "./contact";
|
@@ -84,7 +84,7 @@ export interface Message {
|
|
84
84
|
/**
|
85
85
|
* An array of all mentioned numbers in this message.
|
86
86
|
*/
|
87
|
-
mentionedJidList:
|
87
|
+
mentionedJidList: ContactId[];
|
88
88
|
/**
|
89
89
|
* If the message is of a media type, it may also have a caption
|
90
90
|
*/
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { ContactId } from "./aliases";
|
2
|
+
import { Message, MessageAck } from "./message";
|
3
|
+
/**
|
4
|
+
* A reaction is identified the specific emoji.
|
5
|
+
*/
|
6
|
+
export declare type Reaction = {
|
7
|
+
/**
|
8
|
+
* The aggregate emoji used for the reaction.
|
9
|
+
*/
|
10
|
+
aggregateEmoji: string;
|
11
|
+
/**
|
12
|
+
* The identifier of the reaction
|
13
|
+
*/
|
14
|
+
id: string;
|
15
|
+
/**
|
16
|
+
* If the reaction is also sent by the host account
|
17
|
+
*/
|
18
|
+
hasReactionByMe: boolean;
|
19
|
+
/**
|
20
|
+
* The senders of this spefcific reaction
|
21
|
+
*/
|
22
|
+
senders: ReactionRecord[];
|
23
|
+
};
|
24
|
+
/**
|
25
|
+
* The specific reaction by a user
|
26
|
+
*/
|
27
|
+
export declare type ReactionRecord = {
|
28
|
+
/**
|
29
|
+
* The acknowledgement of the reaction
|
30
|
+
*/
|
31
|
+
ack: MessageAck;
|
32
|
+
/**
|
33
|
+
* The ID of the reaction
|
34
|
+
*/
|
35
|
+
id: string;
|
36
|
+
msgKey: string;
|
37
|
+
parentMsgKey: string;
|
38
|
+
orphan: number;
|
39
|
+
/**
|
40
|
+
* The text of the reaction
|
41
|
+
*/
|
42
|
+
reactionText: string;
|
43
|
+
/**
|
44
|
+
* If the reaction has been read
|
45
|
+
*/
|
46
|
+
read: boolean;
|
47
|
+
/**
|
48
|
+
* The ID of the reaction sender
|
49
|
+
*/
|
50
|
+
senderUserJid: ContactId;
|
51
|
+
/**
|
52
|
+
* The timestamp of the reaction
|
53
|
+
*/
|
54
|
+
timestamp: number;
|
55
|
+
};
|
56
|
+
/**
|
57
|
+
* Emitted by onReaction
|
58
|
+
*/
|
59
|
+
export declare type ReactionEvent = {
|
60
|
+
/**
|
61
|
+
* The message being reacted to
|
62
|
+
*/
|
63
|
+
message: Message;
|
64
|
+
/**
|
65
|
+
* The reaction sent by the host account
|
66
|
+
*/
|
67
|
+
reactionByMe: Reaction;
|
68
|
+
/**
|
69
|
+
* An array of all reactions
|
70
|
+
*/
|
71
|
+
reactions: Reaction[];
|
72
|
+
/**
|
73
|
+
* The type of the reaction event.
|
74
|
+
*/
|
75
|
+
type: 'add' | 'change';
|
76
|
+
};
|
@@ -399,9 +399,10 @@ function create(config = {}) {
|
|
399
399
|
if (metrics.isMd && !(config === null || config === void 0 ? void 0 : config.multiDevice))
|
400
400
|
spinner.info("!!!Please set multiDevice: true in the config or use the --mutli-Device flag!!!");
|
401
401
|
spinner.succeed(`Client loaded for ${metrics.isBiz ? "business" : "normal"} account ${metrics.isMd && "[MD] " || ''}with ${metrics.contacts} contacts, ${metrics.chats} chats & ${metrics.messages} messages ${purgedMessage ? `+ purged ${purgedMessage} ` : ``}in ${LAUNCH_TIME_MS / 1000}s`);
|
402
|
+
debugInfo.ACC_TYPE = metrics.isBiz ? "BUSINESS" : "PERSONAL";
|
402
403
|
if ((config === null || config === void 0 ? void 0 : config.deleteSessionDataOnLogout) || (config === null || config === void 0 ? void 0 : config.killClientOnLogout))
|
403
404
|
config.eventMode = true;
|
404
|
-
const client = new Client_1.Client(waPage, config, debugInfo);
|
405
|
+
const client = new Client_1.Client(waPage, config, Object.assign(Object.assign({}, debugInfo), metrics));
|
405
406
|
const { me } = yield client.getMe();
|
406
407
|
const licIndex = process.argv.findIndex(arg => arg === "--license-key" || arg === "-l");
|
407
408
|
config.licenseKey = config.licenseKey || licIndex !== -1 && process.argv[licIndex + 1];
|
@@ -417,6 +418,9 @@ function create(config = {}) {
|
|
417
418
|
yield client.refresh();
|
418
419
|
spinner.info("Session refreshed.");
|
419
420
|
}
|
421
|
+
const issueLink = yield client.getIssueLink();
|
422
|
+
console.log((0, boxen_1.default)("Use the link below to easily report issues:👇👇👇", { padding: 1, borderColor: 'red' }));
|
423
|
+
spinner.succeed(issueLink);
|
420
424
|
spinner.succeed(`🚀 @OPEN-WA ready for account: ${me.user.slice(-4)}`);
|
421
425
|
spinner.emit('SUCCESS');
|
422
426
|
spinner.remove();
|
package/dist/utils/tools.d.ts
CHANGED
@@ -19,7 +19,6 @@ export declare const isDataURL: (s: string) => boolean;
|
|
19
19
|
* A convinience method to download the [[DataURL]] of a file
|
20
20
|
* @param url The url
|
21
21
|
* @param optionsOverride You can use this to override the [axios request config](https://github.com/axios/axios#request-config)
|
22
|
-
* @returns Promise<DataURL>
|
23
22
|
*/
|
24
23
|
export declare const getDUrl: (url: string, optionsOverride?: AxiosRequestConfig) => Promise<DataURL>;
|
25
24
|
/**
|
package/dist/utils/tools.js
CHANGED
@@ -97,7 +97,6 @@ exports.isDataURL = isDataURL;
|
|
97
97
|
* A convinience method to download the [[DataURL]] of a file
|
98
98
|
* @param url The url
|
99
99
|
* @param optionsOverride You can use this to override the [axios request config](https://github.com/axios/axios#request-config)
|
100
|
-
* @returns Promise<DataURL>
|
101
100
|
*/
|
102
101
|
const getDUrl = (url, optionsOverride = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
103
102
|
// eslint-disable-next-line no-useless-catch
|
@@ -172,9 +171,10 @@ const generateGHIssueLink = (config, sessionInfo, extras = {}) => {
|
|
172
171
|
if (sessionInfo.ACC_TYPE === 'PERSONAL')
|
173
172
|
labels.push('PHA');
|
174
173
|
const qp = Object.assign({ "template": "bug_report.yaml",
|
174
|
+
//@ts-ignore
|
175
175
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
176
176
|
"d_info": `${encodeURI(JSON.stringify(((_a) => {
|
177
|
-
var { OS, PAGE_UA } = _a, o = __rest(_a, ["OS", "PAGE_UA"]);
|
177
|
+
var { OS, purged, PAGE_UA, OW_KEY, NUM, NUM_HASH } = _a, o = __rest(_a, ["OS", "purged", "PAGE_UA", "OW_KEY", "NUM", "NUM_HASH"]);
|
178
178
|
return o;
|
179
179
|
})(sessionInfo), null, 2))}`, "enviro": `${`-%20OS:%20${encodeURI(sessionInfo.OS)}%0A-%20Node:%20${encodeURI(process.versions.node)}%0A-%20npm:%20${(String(npm_ver)).replace(/\s/g, '')}`}`, "labels": labels.join(',') }, extras);
|
180
180
|
return `https://github.com/open-wa/wa-automate-nodejs/issues/new?${Object.keys(qp).map(k => `${k}=${qp[k]}`).join('&')}`;
|
package/package.json
CHANGED