@open-wa/wa-automate 4.33.1 → 4.33.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/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/index.d.ts +1 -0
- package/dist/api/model/index.js +1 -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/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 = {}));
|
package/dist/api/model/index.js
CHANGED
@@ -17,6 +17,7 @@ __exportStar(require("./message"), exports);
|
|
17
17
|
__exportStar(require("./errors"), exports);
|
18
18
|
__exportStar(require("./events"), exports);
|
19
19
|
__exportStar(require("./product"), exports);
|
20
|
+
__exportStar(require("./reactions"), exports);
|
20
21
|
/**
|
21
22
|
* Client status
|
22
23
|
* @readonly
|
@@ -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
|
+
};
|
package/package.json
CHANGED