mezon-js 2.7.50 → 2.7.51
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/mezon-js.cjs.js +28 -146
- package/dist/mezon-js.esm.mjs +28 -146
- package/dist/socket.d.ts +17 -222
- package/package.json +1 -1
- package/socket.ts +36 -374
package/dist/mezon-js.cjs.js
CHANGED
@@ -606,19 +606,6 @@ var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
606
606
|
var utob = (u) => u.replace(re_utob, cb_utob);
|
607
607
|
var _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
608
608
|
var encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
609
|
-
var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
610
|
-
var cb_btou = (cccc) => {
|
611
|
-
switch (cccc.length) {
|
612
|
-
case 4:
|
613
|
-
var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
|
614
|
-
return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
|
615
|
-
case 3:
|
616
|
-
return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
|
617
|
-
default:
|
618
|
-
return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
|
619
|
-
}
|
620
|
-
};
|
621
|
-
var btou = (b) => b.replace(re_btou, cb_btou);
|
622
609
|
var atobPolyfill = (asc) => {
|
623
610
|
asc = asc.replace(/\s+/g, "");
|
624
611
|
if (!b64re.test(asc))
|
@@ -632,10 +619,6 @@ var atobPolyfill = (asc) => {
|
|
632
619
|
return bin;
|
633
620
|
};
|
634
621
|
var _atob = _hasatob ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
635
|
-
var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a), (c) => c.charCodeAt(0));
|
636
|
-
var _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
|
637
|
-
var _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
|
638
|
-
var decode2 = (src) => _decode(_unURI(src));
|
639
622
|
|
640
623
|
// utils.ts
|
641
624
|
function buildFetchOptions(method, options, bodyJson) {
|
@@ -4147,7 +4130,7 @@ var encode2 = function(arraybuffer) {
|
|
4147
4130
|
}
|
4148
4131
|
return base64;
|
4149
4132
|
};
|
4150
|
-
var
|
4133
|
+
var decode2 = function(base64) {
|
4151
4134
|
var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
4152
4135
|
if (base64[base64.length - 1] === "=") {
|
4153
4136
|
bufferLength--;
|
@@ -4190,7 +4173,7 @@ var WebSocketAdapterText = class {
|
|
4190
4173
|
this._socket.onmessage = (evt) => {
|
4191
4174
|
const message = JSON.parse(evt.data);
|
4192
4175
|
if (message.party_data && message.party_data.data) {
|
4193
|
-
message.party_data.data = new Uint8Array(
|
4176
|
+
message.party_data.data = new Uint8Array(decode2(message.party_data.data));
|
4194
4177
|
}
|
4195
4178
|
value(message);
|
4196
4179
|
};
|
@@ -4327,19 +4310,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4327
4310
|
this.onmessagereaction(message.message_reaction_event);
|
4328
4311
|
} else if (message.channel_presence_event) {
|
4329
4312
|
this.onchannelpresence(message.channel_presence_event);
|
4330
|
-
} else if (message.party_data) {
|
4331
|
-
message.party_data.op_code = parseInt(message.party_data.op_code);
|
4332
|
-
this.onpartydata(message.party_data);
|
4333
|
-
} else if (message.party_close) {
|
4334
|
-
this.onpartyclose(message.party_close);
|
4335
|
-
} else if (message.party_join_request) {
|
4336
|
-
this.onpartyjoinrequest(message.party_join_request);
|
4337
|
-
} else if (message.party_leader) {
|
4338
|
-
this.onpartyleader(message.party_leader);
|
4339
|
-
} else if (message.party_presence_event) {
|
4340
|
-
this.onpartypresence(message.party_presence_event);
|
4341
|
-
} else if (message.party) {
|
4342
|
-
this.onparty(message.party);
|
4343
4313
|
} else {
|
4344
4314
|
if (this.verbose && window && window.console) {
|
4345
4315
|
console.log("Unrecognized message received: %o", message);
|
@@ -4427,41 +4397,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4427
4397
|
console.log(notification);
|
4428
4398
|
}
|
4429
4399
|
}
|
4430
|
-
onparty(party) {
|
4431
|
-
if (this.verbose && window && window.console) {
|
4432
|
-
console.log(party);
|
4433
|
-
}
|
4434
|
-
}
|
4435
|
-
onpartyclose(close) {
|
4436
|
-
if (this.verbose && window && window.console) {
|
4437
|
-
console.log("Party closed: " + close);
|
4438
|
-
}
|
4439
|
-
}
|
4440
|
-
onpartyjoinrequest(partyJoinRequest) {
|
4441
|
-
if (this.verbose && window && window.console) {
|
4442
|
-
console.log(partyJoinRequest);
|
4443
|
-
}
|
4444
|
-
}
|
4445
|
-
onpartydata(partyData) {
|
4446
|
-
if (this.verbose && window && window.console) {
|
4447
|
-
console.log(partyData);
|
4448
|
-
}
|
4449
|
-
}
|
4450
|
-
onpartyleader(partyLeader) {
|
4451
|
-
if (this.verbose && window && window.console) {
|
4452
|
-
console.log(partyLeader);
|
4453
|
-
}
|
4454
|
-
}
|
4455
|
-
onpartymatchmakerticket(partyMatched) {
|
4456
|
-
if (this.verbose && window && window.console) {
|
4457
|
-
console.log(partyMatched);
|
4458
|
-
}
|
4459
|
-
}
|
4460
|
-
onpartypresence(partyPresence) {
|
4461
|
-
if (this.verbose && window && window.console) {
|
4462
|
-
console.log(partyPresence);
|
4463
|
-
}
|
4464
|
-
}
|
4465
4400
|
onstatuspresence(statusPresence) {
|
4466
4401
|
if (this.verbose && window && window.console) {
|
4467
4402
|
console.log(statusPresence);
|
@@ -4523,49 +4458,21 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4523
4458
|
if (!this.adapter.isOpen()) {
|
4524
4459
|
reject("Socket connection has not been established yet.");
|
4525
4460
|
} else {
|
4526
|
-
if (untypedMessage.
|
4527
|
-
|
4528
|
-
|
4529
|
-
|
4530
|
-
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4535
|
-
|
4536
|
-
|
4537
|
-
|
4538
|
-
reject("The socket timed out while waiting for a response.");
|
4539
|
-
}, sendTimeout);
|
4540
|
-
untypedMessage.cid = cid;
|
4541
|
-
this.adapter.send(untypedMessage);
|
4542
|
-
}
|
4543
|
-
}
|
4544
|
-
if (this.verbose && window && window.console) {
|
4545
|
-
const loggedMessage = __spreadValues({}, untypedMessage);
|
4546
|
-
if (loggedMessage.match_data_send && loggedMessage.match_data_send.data) {
|
4547
|
-
loggedMessage.match_data_send.data = decode2(loggedMessage.match_data_send.data);
|
4548
|
-
} else if (loggedMessage.party_data_send && loggedMessage.party_data_send.data) {
|
4549
|
-
loggedMessage.party_data_send.data = decode2(loggedMessage.party_data_send.data);
|
4550
|
-
}
|
4551
|
-
console.log("Sent message: %o", JSON.stringify(loggedMessage));
|
4461
|
+
if (untypedMessage.channel_message_send) {
|
4462
|
+
untypedMessage.channel_message_send.content = JSON.stringify(untypedMessage.channel_message_send.content);
|
4463
|
+
} else if (untypedMessage.channel_message_update) {
|
4464
|
+
untypedMessage.channel_message_update.content = JSON.stringify(untypedMessage.channel_message_update.content);
|
4465
|
+
}
|
4466
|
+
const cid = this.generatecid();
|
4467
|
+
this.cIds[cid] = { resolve, reject };
|
4468
|
+
setTimeout(() => {
|
4469
|
+
reject("The socket timed out while waiting for a response.");
|
4470
|
+
}, sendTimeout);
|
4471
|
+
untypedMessage.cid = cid;
|
4472
|
+
this.adapter.send(untypedMessage);
|
4552
4473
|
}
|
4553
4474
|
});
|
4554
4475
|
}
|
4555
|
-
acceptPartyMember(party_id, presence) {
|
4556
|
-
return this.send({ party_accept: { party_id, presence } });
|
4557
|
-
}
|
4558
|
-
closeParty(party_id) {
|
4559
|
-
return __async(this, null, function* () {
|
4560
|
-
return yield this.send({ party_close: { party_id } });
|
4561
|
-
});
|
4562
|
-
}
|
4563
|
-
createParty(open, max_size) {
|
4564
|
-
return __async(this, null, function* () {
|
4565
|
-
const response = yield this.send({ party_create: { open, max_size } });
|
4566
|
-
return response.party;
|
4567
|
-
});
|
4568
|
-
}
|
4569
4476
|
followUsers(userIds) {
|
4570
4477
|
return __async(this, null, function* () {
|
4571
4478
|
const response = yield this.send({ status_follow: { user_ids: userIds } });
|
@@ -4582,13 +4489,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4582
4489
|
return response.clan_join;
|
4583
4490
|
});
|
4584
4491
|
}
|
4585
|
-
joinChat(channel_id,
|
4492
|
+
joinChat(channel_id, mode, type, persistence, hidden) {
|
4586
4493
|
return __async(this, null, function* () {
|
4587
4494
|
const response = yield this.send(
|
4588
4495
|
{
|
4589
4496
|
channel_join: {
|
4590
4497
|
channel_id,
|
4591
|
-
channel_label,
|
4592
4498
|
mode,
|
4593
4499
|
type,
|
4594
4500
|
persistence,
|
@@ -4599,39 +4505,15 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4599
4505
|
return response.channel;
|
4600
4506
|
});
|
4601
4507
|
}
|
4602
|
-
|
4603
|
-
return
|
4604
|
-
return yield this.send({ party_join: { party_id } });
|
4605
|
-
});
|
4606
|
-
}
|
4607
|
-
leaveChat(channel_id, channel_label, mode) {
|
4608
|
-
return this.send({ channel_leave: { channel_id, channel_label, mode } });
|
4609
|
-
}
|
4610
|
-
leaveMatch(matchId) {
|
4611
|
-
return this.send({ match_leave: { match_id: matchId } });
|
4612
|
-
}
|
4613
|
-
leaveParty(party_id) {
|
4614
|
-
return this.send({ party_leave: { party_id } });
|
4615
|
-
}
|
4616
|
-
listPartyJoinRequests(party_id) {
|
4617
|
-
return __async(this, null, function* () {
|
4618
|
-
const response = yield this.send({ party_join_request_list: { party_id } });
|
4619
|
-
return response.party_join_request;
|
4620
|
-
});
|
4621
|
-
}
|
4622
|
-
promotePartyMember(party_id, party_member) {
|
4623
|
-
return __async(this, null, function* () {
|
4624
|
-
const response = yield this.send({ party_promote: { party_id, presence: party_member } });
|
4625
|
-
return response.party_leader;
|
4626
|
-
});
|
4508
|
+
leaveChat(channel_id, mode) {
|
4509
|
+
return this.send({ channel_leave: { channel_id, mode } });
|
4627
4510
|
}
|
4628
|
-
removeChatMessage(channel_id,
|
4511
|
+
removeChatMessage(channel_id, mode, message_id) {
|
4629
4512
|
return __async(this, null, function* () {
|
4630
4513
|
const response = yield this.send(
|
4631
4514
|
{
|
4632
4515
|
channel_message_remove: {
|
4633
4516
|
channel_id,
|
4634
|
-
channel_label,
|
4635
4517
|
mode,
|
4636
4518
|
message_id
|
4637
4519
|
}
|
@@ -4668,36 +4550,36 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4668
4550
|
unfollowUsers(user_ids) {
|
4669
4551
|
return this.send({ status_unfollow: { user_ids } });
|
4670
4552
|
}
|
4671
|
-
updateChatMessage(channel_id,
|
4553
|
+
updateChatMessage(channel_id, mode, message_id, content) {
|
4672
4554
|
return __async(this, null, function* () {
|
4673
|
-
const response = yield this.send({ channel_message_update: { channel_id,
|
4555
|
+
const response = yield this.send({ channel_message_update: { channel_id, message_id, content, mode } });
|
4674
4556
|
return response.channel_message_ack;
|
4675
4557
|
});
|
4676
4558
|
}
|
4677
4559
|
updateStatus(status) {
|
4678
4560
|
return this.send({ status_update: { status } });
|
4679
4561
|
}
|
4680
|
-
writeChatMessage(clan_id, channel_id,
|
4562
|
+
writeChatMessage(clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content) {
|
4681
4563
|
return __async(this, null, function* () {
|
4682
|
-
const response = yield this.send({ channel_message_send: { clan_id, channel_id,
|
4564
|
+
const response = yield this.send({ channel_message_send: { clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content } });
|
4683
4565
|
return response.channel_message_ack;
|
4684
4566
|
});
|
4685
4567
|
}
|
4686
|
-
writeMessageReaction(id, channel_id,
|
4568
|
+
writeMessageReaction(id, channel_id, mode, message_id, emoji, count, message_sender_id, action_delete) {
|
4687
4569
|
return __async(this, null, function* () {
|
4688
|
-
const response = yield this.send({ message_reaction_event: { id, channel_id,
|
4570
|
+
const response = yield this.send({ message_reaction_event: { id, channel_id, mode, message_id, emoji, count, message_sender_id, action: action_delete } });
|
4689
4571
|
return response.message_reaction_event;
|
4690
4572
|
});
|
4691
4573
|
}
|
4692
|
-
writeMessageTyping(channel_id,
|
4574
|
+
writeMessageTyping(channel_id, mode) {
|
4693
4575
|
return __async(this, null, function* () {
|
4694
|
-
const response = yield this.send({ message_typing_event: { channel_id,
|
4576
|
+
const response = yield this.send({ message_typing_event: { channel_id, mode } });
|
4695
4577
|
return response.message_typing_event;
|
4696
4578
|
});
|
4697
4579
|
}
|
4698
|
-
writeLastSeenMessage(channel_id,
|
4580
|
+
writeLastSeenMessage(channel_id, mode, message_id, timestamp) {
|
4699
4581
|
return __async(this, null, function* () {
|
4700
|
-
const response = yield this.send({ last_seen_message_event: { channel_id,
|
4582
|
+
const response = yield this.send({ last_seen_message_event: { channel_id, mode, message_id, timestamp } });
|
4701
4583
|
return response.last_seen_message_event;
|
4702
4584
|
});
|
4703
4585
|
}
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -577,19 +577,6 @@ var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
577
577
|
var utob = (u) => u.replace(re_utob, cb_utob);
|
578
578
|
var _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
579
579
|
var encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
580
|
-
var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
581
|
-
var cb_btou = (cccc) => {
|
582
|
-
switch (cccc.length) {
|
583
|
-
case 4:
|
584
|
-
var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
|
585
|
-
return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
|
586
|
-
case 3:
|
587
|
-
return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
|
588
|
-
default:
|
589
|
-
return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
|
590
|
-
}
|
591
|
-
};
|
592
|
-
var btou = (b) => b.replace(re_btou, cb_btou);
|
593
580
|
var atobPolyfill = (asc) => {
|
594
581
|
asc = asc.replace(/\s+/g, "");
|
595
582
|
if (!b64re.test(asc))
|
@@ -603,10 +590,6 @@ var atobPolyfill = (asc) => {
|
|
603
590
|
return bin;
|
604
591
|
};
|
605
592
|
var _atob = _hasatob ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
606
|
-
var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a), (c) => c.charCodeAt(0));
|
607
|
-
var _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
|
608
|
-
var _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
|
609
|
-
var decode2 = (src) => _decode(_unURI(src));
|
610
593
|
|
611
594
|
// utils.ts
|
612
595
|
function buildFetchOptions(method, options, bodyJson) {
|
@@ -4118,7 +4101,7 @@ var encode2 = function(arraybuffer) {
|
|
4118
4101
|
}
|
4119
4102
|
return base64;
|
4120
4103
|
};
|
4121
|
-
var
|
4104
|
+
var decode2 = function(base64) {
|
4122
4105
|
var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
4123
4106
|
if (base64[base64.length - 1] === "=") {
|
4124
4107
|
bufferLength--;
|
@@ -4161,7 +4144,7 @@ var WebSocketAdapterText = class {
|
|
4161
4144
|
this._socket.onmessage = (evt) => {
|
4162
4145
|
const message = JSON.parse(evt.data);
|
4163
4146
|
if (message.party_data && message.party_data.data) {
|
4164
|
-
message.party_data.data = new Uint8Array(
|
4147
|
+
message.party_data.data = new Uint8Array(decode2(message.party_data.data));
|
4165
4148
|
}
|
4166
4149
|
value(message);
|
4167
4150
|
};
|
@@ -4298,19 +4281,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4298
4281
|
this.onmessagereaction(message.message_reaction_event);
|
4299
4282
|
} else if (message.channel_presence_event) {
|
4300
4283
|
this.onchannelpresence(message.channel_presence_event);
|
4301
|
-
} else if (message.party_data) {
|
4302
|
-
message.party_data.op_code = parseInt(message.party_data.op_code);
|
4303
|
-
this.onpartydata(message.party_data);
|
4304
|
-
} else if (message.party_close) {
|
4305
|
-
this.onpartyclose(message.party_close);
|
4306
|
-
} else if (message.party_join_request) {
|
4307
|
-
this.onpartyjoinrequest(message.party_join_request);
|
4308
|
-
} else if (message.party_leader) {
|
4309
|
-
this.onpartyleader(message.party_leader);
|
4310
|
-
} else if (message.party_presence_event) {
|
4311
|
-
this.onpartypresence(message.party_presence_event);
|
4312
|
-
} else if (message.party) {
|
4313
|
-
this.onparty(message.party);
|
4314
4284
|
} else {
|
4315
4285
|
if (this.verbose && window && window.console) {
|
4316
4286
|
console.log("Unrecognized message received: %o", message);
|
@@ -4398,41 +4368,6 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4398
4368
|
console.log(notification);
|
4399
4369
|
}
|
4400
4370
|
}
|
4401
|
-
onparty(party) {
|
4402
|
-
if (this.verbose && window && window.console) {
|
4403
|
-
console.log(party);
|
4404
|
-
}
|
4405
|
-
}
|
4406
|
-
onpartyclose(close) {
|
4407
|
-
if (this.verbose && window && window.console) {
|
4408
|
-
console.log("Party closed: " + close);
|
4409
|
-
}
|
4410
|
-
}
|
4411
|
-
onpartyjoinrequest(partyJoinRequest) {
|
4412
|
-
if (this.verbose && window && window.console) {
|
4413
|
-
console.log(partyJoinRequest);
|
4414
|
-
}
|
4415
|
-
}
|
4416
|
-
onpartydata(partyData) {
|
4417
|
-
if (this.verbose && window && window.console) {
|
4418
|
-
console.log(partyData);
|
4419
|
-
}
|
4420
|
-
}
|
4421
|
-
onpartyleader(partyLeader) {
|
4422
|
-
if (this.verbose && window && window.console) {
|
4423
|
-
console.log(partyLeader);
|
4424
|
-
}
|
4425
|
-
}
|
4426
|
-
onpartymatchmakerticket(partyMatched) {
|
4427
|
-
if (this.verbose && window && window.console) {
|
4428
|
-
console.log(partyMatched);
|
4429
|
-
}
|
4430
|
-
}
|
4431
|
-
onpartypresence(partyPresence) {
|
4432
|
-
if (this.verbose && window && window.console) {
|
4433
|
-
console.log(partyPresence);
|
4434
|
-
}
|
4435
|
-
}
|
4436
4371
|
onstatuspresence(statusPresence) {
|
4437
4372
|
if (this.verbose && window && window.console) {
|
4438
4373
|
console.log(statusPresence);
|
@@ -4494,49 +4429,21 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4494
4429
|
if (!this.adapter.isOpen()) {
|
4495
4430
|
reject("Socket connection has not been established yet.");
|
4496
4431
|
} else {
|
4497
|
-
if (untypedMessage.
|
4498
|
-
|
4499
|
-
|
4500
|
-
|
4501
|
-
|
4502
|
-
|
4503
|
-
|
4504
|
-
|
4505
|
-
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
reject("The socket timed out while waiting for a response.");
|
4510
|
-
}, sendTimeout);
|
4511
|
-
untypedMessage.cid = cid;
|
4512
|
-
this.adapter.send(untypedMessage);
|
4513
|
-
}
|
4514
|
-
}
|
4515
|
-
if (this.verbose && window && window.console) {
|
4516
|
-
const loggedMessage = __spreadValues({}, untypedMessage);
|
4517
|
-
if (loggedMessage.match_data_send && loggedMessage.match_data_send.data) {
|
4518
|
-
loggedMessage.match_data_send.data = decode2(loggedMessage.match_data_send.data);
|
4519
|
-
} else if (loggedMessage.party_data_send && loggedMessage.party_data_send.data) {
|
4520
|
-
loggedMessage.party_data_send.data = decode2(loggedMessage.party_data_send.data);
|
4521
|
-
}
|
4522
|
-
console.log("Sent message: %o", JSON.stringify(loggedMessage));
|
4432
|
+
if (untypedMessage.channel_message_send) {
|
4433
|
+
untypedMessage.channel_message_send.content = JSON.stringify(untypedMessage.channel_message_send.content);
|
4434
|
+
} else if (untypedMessage.channel_message_update) {
|
4435
|
+
untypedMessage.channel_message_update.content = JSON.stringify(untypedMessage.channel_message_update.content);
|
4436
|
+
}
|
4437
|
+
const cid = this.generatecid();
|
4438
|
+
this.cIds[cid] = { resolve, reject };
|
4439
|
+
setTimeout(() => {
|
4440
|
+
reject("The socket timed out while waiting for a response.");
|
4441
|
+
}, sendTimeout);
|
4442
|
+
untypedMessage.cid = cid;
|
4443
|
+
this.adapter.send(untypedMessage);
|
4523
4444
|
}
|
4524
4445
|
});
|
4525
4446
|
}
|
4526
|
-
acceptPartyMember(party_id, presence) {
|
4527
|
-
return this.send({ party_accept: { party_id, presence } });
|
4528
|
-
}
|
4529
|
-
closeParty(party_id) {
|
4530
|
-
return __async(this, null, function* () {
|
4531
|
-
return yield this.send({ party_close: { party_id } });
|
4532
|
-
});
|
4533
|
-
}
|
4534
|
-
createParty(open, max_size) {
|
4535
|
-
return __async(this, null, function* () {
|
4536
|
-
const response = yield this.send({ party_create: { open, max_size } });
|
4537
|
-
return response.party;
|
4538
|
-
});
|
4539
|
-
}
|
4540
4447
|
followUsers(userIds) {
|
4541
4448
|
return __async(this, null, function* () {
|
4542
4449
|
const response = yield this.send({ status_follow: { user_ids: userIds } });
|
@@ -4553,13 +4460,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4553
4460
|
return response.clan_join;
|
4554
4461
|
});
|
4555
4462
|
}
|
4556
|
-
joinChat(channel_id,
|
4463
|
+
joinChat(channel_id, mode, type, persistence, hidden) {
|
4557
4464
|
return __async(this, null, function* () {
|
4558
4465
|
const response = yield this.send(
|
4559
4466
|
{
|
4560
4467
|
channel_join: {
|
4561
4468
|
channel_id,
|
4562
|
-
channel_label,
|
4563
4469
|
mode,
|
4564
4470
|
type,
|
4565
4471
|
persistence,
|
@@ -4570,39 +4476,15 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4570
4476
|
return response.channel;
|
4571
4477
|
});
|
4572
4478
|
}
|
4573
|
-
|
4574
|
-
return
|
4575
|
-
return yield this.send({ party_join: { party_id } });
|
4576
|
-
});
|
4577
|
-
}
|
4578
|
-
leaveChat(channel_id, channel_label, mode) {
|
4579
|
-
return this.send({ channel_leave: { channel_id, channel_label, mode } });
|
4580
|
-
}
|
4581
|
-
leaveMatch(matchId) {
|
4582
|
-
return this.send({ match_leave: { match_id: matchId } });
|
4583
|
-
}
|
4584
|
-
leaveParty(party_id) {
|
4585
|
-
return this.send({ party_leave: { party_id } });
|
4586
|
-
}
|
4587
|
-
listPartyJoinRequests(party_id) {
|
4588
|
-
return __async(this, null, function* () {
|
4589
|
-
const response = yield this.send({ party_join_request_list: { party_id } });
|
4590
|
-
return response.party_join_request;
|
4591
|
-
});
|
4592
|
-
}
|
4593
|
-
promotePartyMember(party_id, party_member) {
|
4594
|
-
return __async(this, null, function* () {
|
4595
|
-
const response = yield this.send({ party_promote: { party_id, presence: party_member } });
|
4596
|
-
return response.party_leader;
|
4597
|
-
});
|
4479
|
+
leaveChat(channel_id, mode) {
|
4480
|
+
return this.send({ channel_leave: { channel_id, mode } });
|
4598
4481
|
}
|
4599
|
-
removeChatMessage(channel_id,
|
4482
|
+
removeChatMessage(channel_id, mode, message_id) {
|
4600
4483
|
return __async(this, null, function* () {
|
4601
4484
|
const response = yield this.send(
|
4602
4485
|
{
|
4603
4486
|
channel_message_remove: {
|
4604
4487
|
channel_id,
|
4605
|
-
channel_label,
|
4606
4488
|
mode,
|
4607
4489
|
message_id
|
4608
4490
|
}
|
@@ -4639,36 +4521,36 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4639
4521
|
unfollowUsers(user_ids) {
|
4640
4522
|
return this.send({ status_unfollow: { user_ids } });
|
4641
4523
|
}
|
4642
|
-
updateChatMessage(channel_id,
|
4524
|
+
updateChatMessage(channel_id, mode, message_id, content) {
|
4643
4525
|
return __async(this, null, function* () {
|
4644
|
-
const response = yield this.send({ channel_message_update: { channel_id,
|
4526
|
+
const response = yield this.send({ channel_message_update: { channel_id, message_id, content, mode } });
|
4645
4527
|
return response.channel_message_ack;
|
4646
4528
|
});
|
4647
4529
|
}
|
4648
4530
|
updateStatus(status) {
|
4649
4531
|
return this.send({ status_update: { status } });
|
4650
4532
|
}
|
4651
|
-
writeChatMessage(clan_id, channel_id,
|
4533
|
+
writeChatMessage(clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content) {
|
4652
4534
|
return __async(this, null, function* () {
|
4653
|
-
const response = yield this.send({ channel_message_send: { clan_id, channel_id,
|
4535
|
+
const response = yield this.send({ channel_message_send: { clan_id, channel_id, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content } });
|
4654
4536
|
return response.channel_message_ack;
|
4655
4537
|
});
|
4656
4538
|
}
|
4657
|
-
writeMessageReaction(id, channel_id,
|
4539
|
+
writeMessageReaction(id, channel_id, mode, message_id, emoji, count, message_sender_id, action_delete) {
|
4658
4540
|
return __async(this, null, function* () {
|
4659
|
-
const response = yield this.send({ message_reaction_event: { id, channel_id,
|
4541
|
+
const response = yield this.send({ message_reaction_event: { id, channel_id, mode, message_id, emoji, count, message_sender_id, action: action_delete } });
|
4660
4542
|
return response.message_reaction_event;
|
4661
4543
|
});
|
4662
4544
|
}
|
4663
|
-
writeMessageTyping(channel_id,
|
4545
|
+
writeMessageTyping(channel_id, mode) {
|
4664
4546
|
return __async(this, null, function* () {
|
4665
|
-
const response = yield this.send({ message_typing_event: { channel_id,
|
4547
|
+
const response = yield this.send({ message_typing_event: { channel_id, mode } });
|
4666
4548
|
return response.message_typing_event;
|
4667
4549
|
});
|
4668
4550
|
}
|
4669
|
-
writeLastSeenMessage(channel_id,
|
4551
|
+
writeLastSeenMessage(channel_id, mode, message_id, timestamp) {
|
4670
4552
|
return __async(this, null, function* () {
|
4671
|
-
const response = yield this.send({ last_seen_message_event: { channel_id,
|
4553
|
+
const response = yield this.send({ last_seen_message_event: { channel_id, mode, message_id, timestamp } });
|
4672
4554
|
return response.last_seen_message_event;
|
4673
4555
|
});
|
4674
4556
|
}
|