@gqb333/based 2.7.81 → 2.7.82

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.
@@ -1,48 +1,38 @@
1
1
  "use strict";
2
+
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.parseNewsletterMessage = exports.parseNewsletterMetadata = void 0;
5
+
4
6
  const WABinary_1 = require("../WABinary");
5
7
  const generics_1 = require("./generics");
8
+
9
+ const child = (node, tag) => (0, WABinary_1.getBinaryNodeChild)(node, tag);
10
+ const text = (node) => node?.content?.toString();
11
+
6
12
  const parseNewsletterMetadata = (node) => {
7
- const newsletter = (0, WABinary_1.getBinaryNodeChild)(node, 'newsletter');
8
- const name = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'name');
9
- const description = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'description');
10
- const invite = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'invite');
11
- const handle = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'handle');
12
- const verification = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'verification');
13
- const picture = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'picture');
14
- const preview = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'preview');
15
- const creationTime = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'creation_time');
16
- const state = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'state');
17
- const subscribers = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'subscribers');
18
- const viewRole = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'view_role');
19
- const subscribe = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'subscribe');
20
- const muted = (0, WABinary_1.getBinaryNodeChild)(newsletter, 'mute');
13
+ const n = child(node, 'newsletter');
21
14
  return {
22
- id: newsletter.attrs.id,
23
- name: name === null || name === void 0 ? void 0 : name.content.toString(),
24
- description: description === null || description === void 0 ? void 0 : description.content.toString(),
25
- inviteCode: invite === null || invite === void 0 ? void 0 : invite.content.toString(),
26
- handle: handle === null || handle === void 0 ? void 0 : handle.content.toString(),
27
- subscriberCount: +(subscribers === null || subscribers === void 0 ? void 0 : subscribers.content.toString()),
28
- verification: verification === null || verification === void 0 ? void 0 : verification.content.toString(),
29
- picture: picture === null || picture === void 0 ? void 0 : picture.content.toString(),
30
- preview: preview === null || preview === void 0 ? void 0 : preview.content.toString(),
31
- creationTime: +(creationTime === null || creationTime === void 0 ? void 0 : creationTime.content.toString()),
32
- muted: (muted === null || muted === void 0 ? void 0 : muted.content.toString()) === 'true',
33
- state: state === null || state === void 0 ? void 0 : state.content.toString(),
34
- viewRole: viewRole === null || viewRole === void 0 ? void 0 : viewRole.content.toString(),
35
- subscribe: subscribe === null || subscribe === void 0 ? void 0 : subscribe.content.toString(),
15
+ id: n.attrs.id,
16
+ name: text(child(n, 'name')),
17
+ description: text(child(n, 'description')),
18
+ inviteCode: text(child(n, 'invite')),
19
+ handle: text(child(n, 'handle')),
20
+ subscriberCount: +(text(child(n, 'subscribers')) || 0),
21
+ verification: text(child(n, 'verification')),
22
+ picture: text(child(n, 'picture')),
23
+ preview: text(child(n, 'preview')),
24
+ creationTime: +(text(child(n, 'creation_time')) || 0),
25
+ muted: text(child(n, 'mute')) === 'true',
26
+ state: text(child(n, 'state')),
27
+ viewRole: text(child(n, 'view_role')),
28
+ subscribe: text(child(n, 'subscribe')),
36
29
  };
37
30
  };
38
31
  exports.parseNewsletterMetadata = parseNewsletterMetadata;
39
- const parseNewsletterMessage = (node) => {
40
- const message = (0, WABinary_1.getBinaryNodeChild)(node, 'message');
41
- const views = (0, WABinary_1.getBinaryNodeChild)(node, 'views');
42
- return {
43
- serverMsgId: +(node.attrs.server_id || 0),
44
- views: +(views === null || views === void 0 ? void 0 : views.content.toString()),
45
- message: (0, generics_1.normalizeMessageContent)(message),
46
- };
47
- };
32
+
33
+ const parseNewsletterMessage = (node) => ({
34
+ serverMsgId: +(node.attrs.server_id || 0),
35
+ views: +(text(child(node, 'views')) || 0),
36
+ message: (0, generics_1.normalizeMessageContent)(child(node, 'message')),
37
+ });
48
38
  exports.parseNewsletterMessage = parseNewsletterMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gqb333/based",
3
- "version": "2.7.81",
3
+ "version": "2.7.82",
4
4
  "description": "Whatsapp api by GabWT333",
5
5
  "keywords": [
6
6
  "baileys",