@rennzsync/baileys 10.4.0 → 10.5.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/README.id.md +231 -66
- package/README.md +85 -17
- package/WAProto/WAProto.proto +8 -0
- package/WAProto/index.d.ts +121 -0
- package/WAProto/index.js +393 -0
- package/lib/Socket/messages-send.js +13 -1
- package/lib/Utils/a2ui.js +210 -0
- package/lib/Utils/index.js +2 -0
- package/lib/Utils/messages.js +33 -0
- package/lib/Utils/rich-menu.js +211 -0
- package/package.json +1 -1
package/WAProto/index.js
CHANGED
|
@@ -100910,6 +100910,7 @@ export const proto = $root.proto = (() => {
|
|
|
100910
100910
|
* @property {proto.Message.InteractiveMessage.IHeader|null} [header] InteractiveMessage header
|
|
100911
100911
|
* @property {proto.Message.InteractiveMessage.IBody|null} [body] InteractiveMessage body
|
|
100912
100912
|
* @property {proto.Message.InteractiveMessage.IFooter|null} [footer] InteractiveMessage footer
|
|
100913
|
+
* @property {proto.Message.InteractiveMessage.IBloksWidget|null} [bloksWidget] InteractiveMessage bloksWidget
|
|
100913
100914
|
* @property {proto.IContextInfo|null} [contextInfo] InteractiveMessage contextInfo
|
|
100914
100915
|
* @property {proto.IUrlTrackingMap|null} [urlTrackingMap] InteractiveMessage urlTrackingMap
|
|
100915
100916
|
* @property {proto.Message.InteractiveMessage.IShopMessage|null} [shopStorefrontMessage] InteractiveMessage shopStorefrontMessage
|
|
@@ -100957,6 +100958,14 @@ export const proto = $root.proto = (() => {
|
|
|
100957
100958
|
*/
|
|
100958
100959
|
InteractiveMessage.prototype.footer = null;
|
|
100959
100960
|
|
|
100961
|
+
/**
|
|
100962
|
+
* InteractiveMessage bloksWidget.
|
|
100963
|
+
* @member {proto.Message.InteractiveMessage.IBloksWidget|null|undefined} bloksWidget
|
|
100964
|
+
* @memberof proto.Message.InteractiveMessage
|
|
100965
|
+
* @instance
|
|
100966
|
+
*/
|
|
100967
|
+
InteractiveMessage.prototype.bloksWidget = null;
|
|
100968
|
+
|
|
100960
100969
|
/**
|
|
100961
100970
|
* InteractiveMessage contextInfo.
|
|
100962
100971
|
* @member {proto.IContextInfo|null|undefined} contextInfo
|
|
@@ -101026,6 +101035,12 @@ export const proto = $root.proto = (() => {
|
|
|
101026
101035
|
set: $util.oneOfSetter($oneOfFields)
|
|
101027
101036
|
});
|
|
101028
101037
|
|
|
101038
|
+
// Virtual OneOf for proto3 optional field
|
|
101039
|
+
Object.defineProperty(InteractiveMessage.prototype, "_bloksWidget", {
|
|
101040
|
+
get: $util.oneOfGetter($oneOfFields = ["bloksWidget"]),
|
|
101041
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
101042
|
+
});
|
|
101043
|
+
|
|
101029
101044
|
// Virtual OneOf for proto3 optional field
|
|
101030
101045
|
Object.defineProperty(InteractiveMessage.prototype, "_contextInfo", {
|
|
101031
101046
|
get: $util.oneOfGetter($oneOfFields = ["contextInfo"]),
|
|
@@ -101091,6 +101106,8 @@ export const proto = $root.proto = (() => {
|
|
|
101091
101106
|
$root.proto.Message.InteractiveMessage.NativeFlowMessage.encode(message.nativeFlowMessage, writer.uint32(/* id 6, wireType 2 =*/50).fork(), q + 1).ldelim();
|
|
101092
101107
|
if (message.carouselMessage != null && Object.hasOwnProperty.call(message, "carouselMessage"))
|
|
101093
101108
|
$root.proto.Message.InteractiveMessage.CarouselMessage.encode(message.carouselMessage, writer.uint32(/* id 7, wireType 2 =*/58).fork(), q + 1).ldelim();
|
|
101109
|
+
if (message.bloksWidget != null && Object.hasOwnProperty.call(message, "bloksWidget"))
|
|
101110
|
+
$root.proto.Message.InteractiveMessage.BloksWidget.encode(message.bloksWidget, writer.uint32(/* id 8, wireType 2 =*/66).fork(), q + 1).ldelim();
|
|
101094
101111
|
if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo"))
|
|
101095
101112
|
$root.proto.ContextInfo.encode(message.contextInfo, writer.uint32(/* id 15, wireType 2 =*/122).fork(), q + 1).ldelim();
|
|
101096
101113
|
if (message.urlTrackingMap != null && Object.hasOwnProperty.call(message, "urlTrackingMap"))
|
|
@@ -101157,6 +101174,10 @@ export const proto = $root.proto = (() => {
|
|
|
101157
101174
|
message.footer = $root.proto.Message.InteractiveMessage.Footer.decode(reader, reader.uint32(), undefined, long + 1);
|
|
101158
101175
|
break;
|
|
101159
101176
|
}
|
|
101177
|
+
case 8: {
|
|
101178
|
+
message.bloksWidget = $root.proto.Message.InteractiveMessage.BloksWidget.decode(reader, reader.uint32(), undefined, long + 1);
|
|
101179
|
+
break;
|
|
101180
|
+
}
|
|
101160
101181
|
case 15: {
|
|
101161
101182
|
message.contextInfo = $root.proto.ContextInfo.decode(reader, reader.uint32(), undefined, long + 1);
|
|
101162
101183
|
break;
|
|
@@ -101250,6 +101271,14 @@ export const proto = $root.proto = (() => {
|
|
|
101250
101271
|
return "footer." + error;
|
|
101251
101272
|
}
|
|
101252
101273
|
}
|
|
101274
|
+
if (message.bloksWidget != null && Object.hasOwnProperty.call(message, "bloksWidget")) {
|
|
101275
|
+
properties._bloksWidget = 1;
|
|
101276
|
+
{
|
|
101277
|
+
let error = $root.proto.Message.InteractiveMessage.BloksWidget.verify(message.bloksWidget, long + 1);
|
|
101278
|
+
if (error)
|
|
101279
|
+
return "bloksWidget." + error;
|
|
101280
|
+
}
|
|
101281
|
+
}
|
|
101253
101282
|
if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) {
|
|
101254
101283
|
properties._contextInfo = 1;
|
|
101255
101284
|
{
|
|
@@ -101340,6 +101369,11 @@ export const proto = $root.proto = (() => {
|
|
|
101340
101369
|
throw TypeError(".proto.Message.InteractiveMessage.footer: object expected");
|
|
101341
101370
|
message.footer = $root.proto.Message.InteractiveMessage.Footer.fromObject(object.footer, long + 1);
|
|
101342
101371
|
}
|
|
101372
|
+
if (object.bloksWidget != null) {
|
|
101373
|
+
if (!$util.isObject(object.bloksWidget))
|
|
101374
|
+
throw TypeError(".proto.Message.InteractiveMessage.bloksWidget: object expected");
|
|
101375
|
+
message.bloksWidget = $root.proto.Message.InteractiveMessage.BloksWidget.fromObject(object.bloksWidget, long + 1);
|
|
101376
|
+
}
|
|
101343
101377
|
if (object.contextInfo != null) {
|
|
101344
101378
|
if (!$util.isObject(object.contextInfo))
|
|
101345
101379
|
throw TypeError(".proto.Message.InteractiveMessage.contextInfo: object expected");
|
|
@@ -101425,6 +101459,11 @@ export const proto = $root.proto = (() => {
|
|
|
101425
101459
|
if (options.oneofs)
|
|
101426
101460
|
object.interactiveMessage = "carouselMessage";
|
|
101427
101461
|
}
|
|
101462
|
+
if (message.bloksWidget != null && Object.hasOwnProperty.call(message, "bloksWidget")) {
|
|
101463
|
+
object.bloksWidget = $root.proto.Message.InteractiveMessage.BloksWidget.toObject(message.bloksWidget, options, q + 1);
|
|
101464
|
+
if (options.oneofs)
|
|
101465
|
+
object._bloksWidget = "bloksWidget";
|
|
101466
|
+
}
|
|
101428
101467
|
if (message.contextInfo != null && Object.hasOwnProperty.call(message, "contextInfo")) {
|
|
101429
101468
|
object.contextInfo = $root.proto.ContextInfo.toObject(message.contextInfo, options, q + 1);
|
|
101430
101469
|
if (options.oneofs)
|
|
@@ -101464,6 +101503,360 @@ export const proto = $root.proto = (() => {
|
|
|
101464
101503
|
return typeUrlPrefix + "/proto.Message.InteractiveMessage";
|
|
101465
101504
|
};
|
|
101466
101505
|
|
|
101506
|
+
InteractiveMessage.BloksWidget = (function() {
|
|
101507
|
+
|
|
101508
|
+
/**
|
|
101509
|
+
* Properties of a BloksWidget.
|
|
101510
|
+
* @memberof proto.Message.InteractiveMessage
|
|
101511
|
+
* @interface IBloksWidget
|
|
101512
|
+
* @property {string|null} [uuid] BloksWidget uuid
|
|
101513
|
+
* @property {string|null} [data] BloksWidget data
|
|
101514
|
+
* @property {string|null} [type] BloksWidget type
|
|
101515
|
+
* @property {string|null} [fallback] BloksWidget fallback
|
|
101516
|
+
*/
|
|
101517
|
+
|
|
101518
|
+
/**
|
|
101519
|
+
* Constructs a new BloksWidget.
|
|
101520
|
+
* @memberof proto.Message.InteractiveMessage
|
|
101521
|
+
* @classdesc Represents a BloksWidget.
|
|
101522
|
+
* @implements IBloksWidget
|
|
101523
|
+
* @constructor
|
|
101524
|
+
* @param {proto.Message.InteractiveMessage.IBloksWidget=} [properties] Properties to set
|
|
101525
|
+
*/
|
|
101526
|
+
function BloksWidget(properties) {
|
|
101527
|
+
if (properties)
|
|
101528
|
+
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
|
|
101529
|
+
if (properties[keys[i]] != null && keys[i] !== "__proto__")
|
|
101530
|
+
this[keys[i]] = properties[keys[i]];
|
|
101531
|
+
}
|
|
101532
|
+
|
|
101533
|
+
/**
|
|
101534
|
+
* BloksWidget uuid.
|
|
101535
|
+
* @member {string|null|undefined} uuid
|
|
101536
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101537
|
+
* @instance
|
|
101538
|
+
*/
|
|
101539
|
+
BloksWidget.prototype.uuid = null;
|
|
101540
|
+
|
|
101541
|
+
/**
|
|
101542
|
+
* BloksWidget data.
|
|
101543
|
+
* @member {string|null|undefined} data
|
|
101544
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101545
|
+
* @instance
|
|
101546
|
+
*/
|
|
101547
|
+
BloksWidget.prototype.data = null;
|
|
101548
|
+
|
|
101549
|
+
/**
|
|
101550
|
+
* BloksWidget type.
|
|
101551
|
+
* @member {string|null|undefined} type
|
|
101552
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101553
|
+
* @instance
|
|
101554
|
+
*/
|
|
101555
|
+
BloksWidget.prototype.type = null;
|
|
101556
|
+
|
|
101557
|
+
/**
|
|
101558
|
+
* BloksWidget fallback.
|
|
101559
|
+
* @member {string|null|undefined} fallback
|
|
101560
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101561
|
+
* @instance
|
|
101562
|
+
*/
|
|
101563
|
+
BloksWidget.prototype.fallback = null;
|
|
101564
|
+
|
|
101565
|
+
// OneOf field names bound to virtual getters and setters
|
|
101566
|
+
let $oneOfFields;
|
|
101567
|
+
|
|
101568
|
+
// Virtual OneOf for proto3 optional field
|
|
101569
|
+
Object.defineProperty(BloksWidget.prototype, "_uuid", {
|
|
101570
|
+
get: $util.oneOfGetter($oneOfFields = ["uuid"]),
|
|
101571
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
101572
|
+
});
|
|
101573
|
+
|
|
101574
|
+
// Virtual OneOf for proto3 optional field
|
|
101575
|
+
Object.defineProperty(BloksWidget.prototype, "_data", {
|
|
101576
|
+
get: $util.oneOfGetter($oneOfFields = ["data"]),
|
|
101577
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
101578
|
+
});
|
|
101579
|
+
|
|
101580
|
+
// Virtual OneOf for proto3 optional field
|
|
101581
|
+
Object.defineProperty(BloksWidget.prototype, "_type", {
|
|
101582
|
+
get: $util.oneOfGetter($oneOfFields = ["type"]),
|
|
101583
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
101584
|
+
});
|
|
101585
|
+
|
|
101586
|
+
// Virtual OneOf for proto3 optional field
|
|
101587
|
+
Object.defineProperty(BloksWidget.prototype, "_fallback", {
|
|
101588
|
+
get: $util.oneOfGetter($oneOfFields = ["fallback"]),
|
|
101589
|
+
set: $util.oneOfSetter($oneOfFields)
|
|
101590
|
+
});
|
|
101591
|
+
|
|
101592
|
+
/**
|
|
101593
|
+
* Creates a new BloksWidget instance using the specified properties.
|
|
101594
|
+
* @function create
|
|
101595
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101596
|
+
* @static
|
|
101597
|
+
* @param {proto.Message.InteractiveMessage.IBloksWidget=} [properties] Properties to set
|
|
101598
|
+
* @returns {proto.Message.InteractiveMessage.BloksWidget} BloksWidget instance
|
|
101599
|
+
*/
|
|
101600
|
+
BloksWidget.create = function create(properties) {
|
|
101601
|
+
return new BloksWidget(properties);
|
|
101602
|
+
};
|
|
101603
|
+
|
|
101604
|
+
/**
|
|
101605
|
+
* Encodes the specified BloksWidget message. Does not implicitly {@link proto.Message.InteractiveMessage.BloksWidget.verify|verify} messages.
|
|
101606
|
+
* @function encode
|
|
101607
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101608
|
+
* @static
|
|
101609
|
+
* @param {proto.Message.InteractiveMessage.IBloksWidget} message BloksWidget message or plain object to encode
|
|
101610
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
101611
|
+
* @returns {$protobuf.Writer} Writer
|
|
101612
|
+
*/
|
|
101613
|
+
BloksWidget.encode = function encode(message, writer, q) {
|
|
101614
|
+
if (!writer)
|
|
101615
|
+
writer = $Writer.create();
|
|
101616
|
+
if (q === undefined)
|
|
101617
|
+
q = 0;
|
|
101618
|
+
if (q > $util.recursionLimit)
|
|
101619
|
+
throw Error("max depth exceeded");
|
|
101620
|
+
if (message.uuid != null && Object.hasOwnProperty.call(message, "uuid"))
|
|
101621
|
+
writer.uint32(/* id 1, wireType 2 =*/10).string(message.uuid);
|
|
101622
|
+
if (message.data != null && Object.hasOwnProperty.call(message, "data"))
|
|
101623
|
+
writer.uint32(/* id 2, wireType 2 =*/18).string(message.data);
|
|
101624
|
+
if (message.type != null && Object.hasOwnProperty.call(message, "type"))
|
|
101625
|
+
writer.uint32(/* id 3, wireType 2 =*/26).string(message.type);
|
|
101626
|
+
if (message.fallback != null && Object.hasOwnProperty.call(message, "fallback"))
|
|
101627
|
+
writer.uint32(/* id 4, wireType 2 =*/34).string(message.fallback);
|
|
101628
|
+
return writer;
|
|
101629
|
+
};
|
|
101630
|
+
|
|
101631
|
+
/**
|
|
101632
|
+
* Encodes the specified BloksWidget message, length delimited. Does not implicitly {@link proto.Message.InteractiveMessage.BloksWidget.verify|verify} messages.
|
|
101633
|
+
* @function encodeDelimited
|
|
101634
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101635
|
+
* @static
|
|
101636
|
+
* @param {proto.Message.InteractiveMessage.IBloksWidget} message BloksWidget message or plain object to encode
|
|
101637
|
+
* @param {$protobuf.Writer} [writer] Writer to encode to
|
|
101638
|
+
* @returns {$protobuf.Writer} Writer
|
|
101639
|
+
*/
|
|
101640
|
+
BloksWidget.encodeDelimited = function encodeDelimited(message, writer) {
|
|
101641
|
+
return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
|
|
101642
|
+
};
|
|
101643
|
+
|
|
101644
|
+
/**
|
|
101645
|
+
* Decodes a BloksWidget message from the specified reader or buffer.
|
|
101646
|
+
* @function decode
|
|
101647
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101648
|
+
* @static
|
|
101649
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
101650
|
+
* @param {number} [length] Message length if known beforehand
|
|
101651
|
+
* @returns {proto.Message.InteractiveMessage.BloksWidget} BloksWidget
|
|
101652
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
101653
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
101654
|
+
*/
|
|
101655
|
+
BloksWidget.decode = function decode(reader, length, error, long) {
|
|
101656
|
+
if (!(reader instanceof $Reader))
|
|
101657
|
+
reader = $Reader.create(reader);
|
|
101658
|
+
if (long === undefined)
|
|
101659
|
+
long = 0;
|
|
101660
|
+
if (long > $Reader.recursionLimit)
|
|
101661
|
+
throw Error("maximum nesting depth exceeded");
|
|
101662
|
+
let end, message;
|
|
101663
|
+
if (length === undefined)
|
|
101664
|
+
end = reader.len;
|
|
101665
|
+
else {
|
|
101666
|
+
end = reader.pos + length;
|
|
101667
|
+
if (end > reader.len)
|
|
101668
|
+
throw RangeError("index out of range");
|
|
101669
|
+
length = reader.len;
|
|
101670
|
+
reader.len = end;
|
|
101671
|
+
}
|
|
101672
|
+
message = new $root.proto.Message.InteractiveMessage.BloksWidget();
|
|
101673
|
+
while (reader.pos < end) {
|
|
101674
|
+
let tag = reader.uint32();
|
|
101675
|
+
if (tag === error)
|
|
101676
|
+
break;
|
|
101677
|
+
switch (tag >>> 3) {
|
|
101678
|
+
case 1: {
|
|
101679
|
+
message.uuid = reader.string();
|
|
101680
|
+
break;
|
|
101681
|
+
}
|
|
101682
|
+
case 2: {
|
|
101683
|
+
message.data = reader.string();
|
|
101684
|
+
break;
|
|
101685
|
+
}
|
|
101686
|
+
case 3: {
|
|
101687
|
+
message.type = reader.string();
|
|
101688
|
+
break;
|
|
101689
|
+
}
|
|
101690
|
+
case 4: {
|
|
101691
|
+
message.fallback = reader.string();
|
|
101692
|
+
break;
|
|
101693
|
+
}
|
|
101694
|
+
default:
|
|
101695
|
+
reader.skipType(tag & 7, long);
|
|
101696
|
+
break;
|
|
101697
|
+
}
|
|
101698
|
+
}
|
|
101699
|
+
if (length !== undefined) {
|
|
101700
|
+
if (reader.pos !== end)
|
|
101701
|
+
throw RangeError("index out of range");
|
|
101702
|
+
reader.len = length;
|
|
101703
|
+
}
|
|
101704
|
+
return message;
|
|
101705
|
+
};
|
|
101706
|
+
|
|
101707
|
+
/**
|
|
101708
|
+
* Decodes a BloksWidget message from the specified reader or buffer, length delimited.
|
|
101709
|
+
* @function decodeDelimited
|
|
101710
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101711
|
+
* @static
|
|
101712
|
+
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
|
|
101713
|
+
* @returns {proto.Message.InteractiveMessage.BloksWidget} BloksWidget
|
|
101714
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
101715
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
101716
|
+
*/
|
|
101717
|
+
BloksWidget.decodeDelimited = function decodeDelimited(reader) {
|
|
101718
|
+
if (!(reader instanceof $Reader))
|
|
101719
|
+
reader = new $Reader(reader);
|
|
101720
|
+
return this.decode(reader, reader.uint32());
|
|
101721
|
+
};
|
|
101722
|
+
|
|
101723
|
+
/**
|
|
101724
|
+
* Verifies a BloksWidget message.
|
|
101725
|
+
* @function verify
|
|
101726
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101727
|
+
* @static
|
|
101728
|
+
* @param {Object.<string,*>} message Plain object to verify
|
|
101729
|
+
* @returns {string|null} `null` if valid, otherwise the reason why it is not
|
|
101730
|
+
*/
|
|
101731
|
+
BloksWidget.verify = function verify(message, long) {
|
|
101732
|
+
if (typeof message !== "object" || message === null)
|
|
101733
|
+
return "object expected";
|
|
101734
|
+
if (long === undefined)
|
|
101735
|
+
long = 0;
|
|
101736
|
+
if (long > $util.recursionLimit)
|
|
101737
|
+
return "maximum nesting depth exceeded";
|
|
101738
|
+
let properties = {};
|
|
101739
|
+
if (message.uuid != null && Object.hasOwnProperty.call(message, "uuid")) {
|
|
101740
|
+
properties._uuid = 1;
|
|
101741
|
+
if (!$util.isString(message.uuid))
|
|
101742
|
+
return "uuid: string expected";
|
|
101743
|
+
}
|
|
101744
|
+
if (message.data != null && Object.hasOwnProperty.call(message, "data")) {
|
|
101745
|
+
properties._data = 1;
|
|
101746
|
+
if (!$util.isString(message.data))
|
|
101747
|
+
return "data: string expected";
|
|
101748
|
+
}
|
|
101749
|
+
if (message.type != null && Object.hasOwnProperty.call(message, "type")) {
|
|
101750
|
+
properties._type = 1;
|
|
101751
|
+
if (!$util.isString(message.type))
|
|
101752
|
+
return "type: string expected";
|
|
101753
|
+
}
|
|
101754
|
+
if (message.fallback != null && Object.hasOwnProperty.call(message, "fallback")) {
|
|
101755
|
+
properties._fallback = 1;
|
|
101756
|
+
if (!$util.isString(message.fallback))
|
|
101757
|
+
return "fallback: string expected";
|
|
101758
|
+
}
|
|
101759
|
+
return null;
|
|
101760
|
+
};
|
|
101761
|
+
|
|
101762
|
+
/**
|
|
101763
|
+
* Creates a BloksWidget message from a plain object. Also converts values to their respective internal types.
|
|
101764
|
+
* @function fromObject
|
|
101765
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101766
|
+
* @static
|
|
101767
|
+
* @param {Object.<string,*>} object Plain object
|
|
101768
|
+
* @returns {proto.Message.InteractiveMessage.BloksWidget} BloksWidget
|
|
101769
|
+
*/
|
|
101770
|
+
BloksWidget.fromObject = function fromObject(object, long) {
|
|
101771
|
+
if (object instanceof $root.proto.Message.InteractiveMessage.BloksWidget)
|
|
101772
|
+
return object;
|
|
101773
|
+
if (!$util.isObject(object))
|
|
101774
|
+
throw TypeError(".proto.Message.InteractiveMessage.BloksWidget: object expected");
|
|
101775
|
+
if (long === undefined)
|
|
101776
|
+
long = 0;
|
|
101777
|
+
if (long > $util.recursionLimit)
|
|
101778
|
+
throw Error("maximum nesting depth exceeded");
|
|
101779
|
+
let message = new $root.proto.Message.InteractiveMessage.BloksWidget();
|
|
101780
|
+
if (object.uuid != null)
|
|
101781
|
+
message.uuid = String(object.uuid);
|
|
101782
|
+
if (object.data != null)
|
|
101783
|
+
message.data = String(object.data);
|
|
101784
|
+
if (object.type != null)
|
|
101785
|
+
message.type = String(object.type);
|
|
101786
|
+
if (object.fallback != null)
|
|
101787
|
+
message.fallback = String(object.fallback);
|
|
101788
|
+
return message;
|
|
101789
|
+
};
|
|
101790
|
+
|
|
101791
|
+
/**
|
|
101792
|
+
* Creates a plain object from a BloksWidget message. Also converts values to other types if specified.
|
|
101793
|
+
* @function toObject
|
|
101794
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101795
|
+
* @static
|
|
101796
|
+
* @param {proto.Message.InteractiveMessage.BloksWidget} message BloksWidget
|
|
101797
|
+
* @param {$protobuf.IConversionOptions} [options] Conversion options
|
|
101798
|
+
* @returns {Object.<string,*>} Plain object
|
|
101799
|
+
*/
|
|
101800
|
+
BloksWidget.toObject = function toObject(message, options, q) {
|
|
101801
|
+
if (!options)
|
|
101802
|
+
options = {};
|
|
101803
|
+
if (q === undefined)
|
|
101804
|
+
q = 0;
|
|
101805
|
+
if (q > $util.recursionLimit)
|
|
101806
|
+
throw Error("max depth exceeded");
|
|
101807
|
+
let object = {};
|
|
101808
|
+
if (message.uuid != null && Object.hasOwnProperty.call(message, "uuid")) {
|
|
101809
|
+
object.uuid = message.uuid;
|
|
101810
|
+
if (options.oneofs)
|
|
101811
|
+
object._uuid = "uuid";
|
|
101812
|
+
}
|
|
101813
|
+
if (message.data != null && Object.hasOwnProperty.call(message, "data")) {
|
|
101814
|
+
object.data = message.data;
|
|
101815
|
+
if (options.oneofs)
|
|
101816
|
+
object._data = "data";
|
|
101817
|
+
}
|
|
101818
|
+
if (message.type != null && Object.hasOwnProperty.call(message, "type")) {
|
|
101819
|
+
object.type = message.type;
|
|
101820
|
+
if (options.oneofs)
|
|
101821
|
+
object._type = "type";
|
|
101822
|
+
}
|
|
101823
|
+
if (message.fallback != null && Object.hasOwnProperty.call(message, "fallback")) {
|
|
101824
|
+
object.fallback = message.fallback;
|
|
101825
|
+
if (options.oneofs)
|
|
101826
|
+
object._fallback = "fallback";
|
|
101827
|
+
}
|
|
101828
|
+
return object;
|
|
101829
|
+
};
|
|
101830
|
+
|
|
101831
|
+
/**
|
|
101832
|
+
* Converts this BloksWidget to JSON.
|
|
101833
|
+
* @function toJSON
|
|
101834
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101835
|
+
* @instance
|
|
101836
|
+
* @returns {Object.<string,*>} JSON object
|
|
101837
|
+
*/
|
|
101838
|
+
BloksWidget.prototype.toJSON = function toJSON() {
|
|
101839
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
|
101840
|
+
};
|
|
101841
|
+
|
|
101842
|
+
/**
|
|
101843
|
+
* Gets the default type url for BloksWidget
|
|
101844
|
+
* @function getTypeUrl
|
|
101845
|
+
* @memberof proto.Message.InteractiveMessage.BloksWidget
|
|
101846
|
+
* @static
|
|
101847
|
+
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
|
|
101848
|
+
* @returns {string} The default type url
|
|
101849
|
+
*/
|
|
101850
|
+
BloksWidget.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
|
|
101851
|
+
if (typeUrlPrefix === undefined) {
|
|
101852
|
+
typeUrlPrefix = "type.googleapis.com";
|
|
101853
|
+
}
|
|
101854
|
+
return typeUrlPrefix + "/proto.Message.InteractiveMessage.BloksWidget";
|
|
101855
|
+
};
|
|
101856
|
+
|
|
101857
|
+
return BloksWidget;
|
|
101858
|
+
})();
|
|
101859
|
+
|
|
101467
101860
|
InteractiveMessage.Body = (function() {
|
|
101468
101861
|
|
|
101469
101862
|
/**
|
|
@@ -2,9 +2,11 @@ import NodeCache from '@cacheable/node-cache';
|
|
|
2
2
|
import { Boom } from '@hapi/boom';
|
|
3
3
|
import { proto } from '../../WAProto/index.js';
|
|
4
4
|
import { DEFAULT_CACHE_TTLS, WA_DEFAULT_EPHEMERAL } from '../Defaults/index.js';
|
|
5
|
-
import { aggregateMessageKeysNotFromMe, assertMediaContent, assertMeId, bindWaitForEvent, decryptMediaRetryData, DEF_MEDIA_HOST, encodeNewsletterMessage, encodeSignedDeviceIdentity, encodeWAMessage, encryptMediaRetryRequest, extractDeviceJids, generateMessageIDV2, generateParticipantHashV2, generateWAMessage, getStatusCodeForMediaRetry, getUrlFromDirectPath, getWAUploadToServer, MessageRetryManager, normalizeMessageContent, parseAndInjectE2ESessions, unixTimestampSeconds } from '../Utils/index.js';
|
|
5
|
+
import { aggregateMessageKeysNotFromMe, assertMediaContent, assertMeId, bindWaitForEvent, decryptMediaRetryData, DEF_MEDIA_HOST, encodeNewsletterMessage, encodeSignedDeviceIdentity, encodeWAMessage, encryptMediaRetryRequest, extractDeviceJids, generateMessageIDV2, generateParticipantHashV2, generateWAMessage, generateWAMessageFromContent, getStatusCodeForMediaRetry, getUrlFromDirectPath, getWAUploadToServer, MessageRetryManager, normalizeMessageContent, parseAndInjectE2ESessions, unixTimestampSeconds } from '../Utils/index.js';
|
|
6
6
|
import { getUrlInfo } from '../Utils/link-preview.js';
|
|
7
7
|
import { makeKeyedMutex, makeMutex } from '../Utils/make-mutex.js';
|
|
8
|
+
import { buildRichMenuMessage } from '../Utils/rich-menu.js';
|
|
9
|
+
import { sendA2UIWidget } from '../Utils/a2ui.js';
|
|
8
10
|
import { getMessageReportingToken, shouldIncludeReportingToken } from '../Utils/reporting-utils.js';
|
|
9
11
|
import { buildMergedTcTokenIndexWrite, isTcTokenExpired, resolveIssuanceJid, resolveTcTokenJid, shouldSendNewTcToken, storeTcTokensFromIqResult } from '../Utils/tc-token-utils.js';
|
|
10
12
|
import { areJidsSameUser, getAdditionalNode, getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isJidBot, isJidGroup, isJidMetaAI, isLidUser, isPnUser, jidDecode, jidEncode, jidNormalizedUser, PSA_WID, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
@@ -1098,6 +1100,16 @@ export const makeMessagesSocket = (config) => {
|
|
|
1098
1100
|
ev.emit('messages.update', [{ key: message.key, update: { message: message.message } }]);
|
|
1099
1101
|
return message;
|
|
1100
1102
|
},
|
|
1103
|
+
// Rich menu (tombol/kartu geser/header gambar/footer URL) — port dari @vansnowi/baileys
|
|
1104
|
+
richMenu: async (jid, content = {}) => {
|
|
1105
|
+
const waMsg = generateWAMessageFromContent(jid, buildRichMenuMessage(content), {
|
|
1106
|
+
userJid: authState.creds.me.id
|
|
1107
|
+
});
|
|
1108
|
+
await relayMessage(jid, waMsg.message, { messageId: waMsg.key.id });
|
|
1109
|
+
return waMsg;
|
|
1110
|
+
},
|
|
1111
|
+
// Widget A2UI (interactiveMessage.bloksWidget) — sock.sendA2UI(jid, { a2ui, bodyText, footer, buttons, ... })
|
|
1112
|
+
sendA2UI: (jid, options = {}) => sendA2UIWidget({ relayMessage, user: authState.creds.me }, jid, options),
|
|
1101
1113
|
sendMessage: async (jid, content, options = {}) => {
|
|
1102
1114
|
const userJid = authState.creds.me.id;
|
|
1103
1115
|
if (typeof content === 'object' &&
|