mezon-js 2.7.71 → 2.7.74
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +16 -43
- package/dist/api.gen.d.ts +10 -10
- package/dist/mezon-js.cjs.js +21 -26
- package/dist/mezon-js.esm.mjs +21 -26
- package/dist/socket.d.ts +23 -1
- package/package.json +1 -1
- package/socket.ts +54 -1
package/api.gen.ts
CHANGED
@@ -484,16 +484,6 @@ export interface ApiClanDescProfile {
|
|
484
484
|
profile_theme?: string;
|
485
485
|
}
|
486
486
|
|
487
|
-
/** */
|
488
|
-
export interface ApiClanEmoji {
|
489
|
-
//
|
490
|
-
category?: string;
|
491
|
-
//
|
492
|
-
shortname?: string;
|
493
|
-
//
|
494
|
-
src?: string;
|
495
|
-
}
|
496
|
-
|
497
487
|
/** */
|
498
488
|
export interface ApiClanEmojiCreateRequest {
|
499
489
|
//
|
@@ -509,7 +499,21 @@ export interface ApiClanEmojiCreateRequest {
|
|
509
499
|
/** */
|
510
500
|
export interface ApiClanEmojiList {
|
511
501
|
//
|
512
|
-
emoji_list?: Array<
|
502
|
+
emoji_list?: Array<ApiClanEmojiListResponse>;
|
503
|
+
}
|
504
|
+
|
505
|
+
/** */
|
506
|
+
export interface ApiClanEmojiListResponse {
|
507
|
+
//
|
508
|
+
category?: string;
|
509
|
+
//
|
510
|
+
creator_id?: string;
|
511
|
+
//
|
512
|
+
id?: string;
|
513
|
+
//
|
514
|
+
shortname?: string;
|
515
|
+
//
|
516
|
+
src?: string;
|
513
517
|
}
|
514
518
|
|
515
519
|
/** Get clan profile. */
|
@@ -3704,38 +3708,7 @@ export class MezonApi {
|
|
3704
3708
|
]);
|
3705
3709
|
}
|
3706
3710
|
|
3707
|
-
/**
|
3708
|
-
listClanEmoji(bearerToken: string,
|
3709
|
-
options: any = {}): Promise<ApiClanEmojiList> {
|
3710
|
-
|
3711
|
-
const urlPath = "/v2/emoji";
|
3712
|
-
const queryParams = new Map<string, any>();
|
3713
|
-
|
3714
|
-
let bodyJson : string = "";
|
3715
|
-
|
3716
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3717
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
3718
|
-
if (bearerToken) {
|
3719
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3720
|
-
}
|
3721
|
-
|
3722
|
-
return Promise.race([
|
3723
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
3724
|
-
if (response.status == 204) {
|
3725
|
-
return response;
|
3726
|
-
} else if (response.status >= 200 && response.status < 300) {
|
3727
|
-
return response.json();
|
3728
|
-
} else {
|
3729
|
-
throw response;
|
3730
|
-
}
|
3731
|
-
}),
|
3732
|
-
new Promise((_, reject) =>
|
3733
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3734
|
-
),
|
3735
|
-
]);
|
3736
|
-
}
|
3737
|
-
|
3738
|
-
/** Post permission Emoji /v2/emoji/create */
|
3711
|
+
/** Post clan Emoji /v2/emoji/create */
|
3739
3712
|
createClanEmoji(bearerToken: string,
|
3740
3713
|
body:ApiClanEmojiCreateRequest,
|
3741
3714
|
options: any = {}): Promise<any> {
|
package/dist/api.gen.d.ts
CHANGED
@@ -277,12 +277,6 @@ export interface ApiClanDescProfile {
|
|
277
277
|
profile_theme?: string;
|
278
278
|
}
|
279
279
|
/** */
|
280
|
-
export interface ApiClanEmoji {
|
281
|
-
category?: string;
|
282
|
-
shortname?: string;
|
283
|
-
src?: string;
|
284
|
-
}
|
285
|
-
/** */
|
286
280
|
export interface ApiClanEmojiCreateRequest {
|
287
281
|
category?: string;
|
288
282
|
clan_id?: string;
|
@@ -291,7 +285,15 @@ export interface ApiClanEmojiCreateRequest {
|
|
291
285
|
}
|
292
286
|
/** */
|
293
287
|
export interface ApiClanEmojiList {
|
294
|
-
emoji_list?: Array<
|
288
|
+
emoji_list?: Array<ApiClanEmojiListResponse>;
|
289
|
+
}
|
290
|
+
/** */
|
291
|
+
export interface ApiClanEmojiListResponse {
|
292
|
+
category?: string;
|
293
|
+
creator_id?: string;
|
294
|
+
id?: string;
|
295
|
+
shortname?: string;
|
296
|
+
src?: string;
|
295
297
|
}
|
296
298
|
/** Get clan profile. */
|
297
299
|
export interface ApiClanProfile {
|
@@ -976,9 +978,7 @@ export declare class MezonApi {
|
|
976
978
|
closeDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
977
979
|
/** open direct message. */
|
978
980
|
openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
|
979
|
-
/**
|
980
|
-
listClanEmoji(bearerToken: string, options?: any): Promise<ApiClanEmojiList>;
|
981
|
-
/** Post permission Emoji /v2/emoji/create */
|
981
|
+
/** Post clan Emoji /v2/emoji/create */
|
982
982
|
createClanEmoji(bearerToken: string, body: ApiClanEmojiCreateRequest, options?: any): Promise<any>;
|
983
983
|
/** Get emoji list by clan id */
|
984
984
|
listClanEmojiByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanEmojiList>;
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -2387,32 +2387,7 @@ var MezonApi = class {
|
|
2387
2387
|
)
|
2388
2388
|
]);
|
2389
2389
|
}
|
2390
|
-
/**
|
2391
|
-
listClanEmoji(bearerToken, options = {}) {
|
2392
|
-
const urlPath = "/v2/emoji";
|
2393
|
-
const queryParams = /* @__PURE__ */ new Map();
|
2394
|
-
let bodyJson = "";
|
2395
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2396
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2397
|
-
if (bearerToken) {
|
2398
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2399
|
-
}
|
2400
|
-
return Promise.race([
|
2401
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
2402
|
-
if (response.status == 204) {
|
2403
|
-
return response;
|
2404
|
-
} else if (response.status >= 200 && response.status < 300) {
|
2405
|
-
return response.json();
|
2406
|
-
} else {
|
2407
|
-
throw response;
|
2408
|
-
}
|
2409
|
-
}),
|
2410
|
-
new Promise(
|
2411
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2412
|
-
)
|
2413
|
-
]);
|
2414
|
-
}
|
2415
|
-
/** Post permission Emoji /v2/emoji/create */
|
2390
|
+
/** Post clan Emoji /v2/emoji/create */
|
2416
2391
|
createClanEmoji(bearerToken, body, options = {}) {
|
2417
2392
|
if (body === null || body === void 0) {
|
2418
2393
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
@@ -4538,6 +4513,10 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4538
4513
|
this.onchannelpresence(message.channel_presence_event);
|
4539
4514
|
} else if (message.last_pin_message_event) {
|
4540
4515
|
this.onpinmessage(message.last_pin_message_event);
|
4516
|
+
} else if (message.custom_status_event) {
|
4517
|
+
this.oncustomstatus(message.custom_status_event);
|
4518
|
+
} else if (message.user_channel_added_event) {
|
4519
|
+
this.onuserchanneladded(message.user_channel_added_event);
|
4541
4520
|
} else {
|
4542
4521
|
if (this.verbose && window && window.console) {
|
4543
4522
|
console.log("Unrecognized message received: %o", message);
|
@@ -4620,6 +4599,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4620
4599
|
console.log(channelPresence);
|
4621
4600
|
}
|
4622
4601
|
}
|
4602
|
+
onuserchanneladded(user) {
|
4603
|
+
if (this.verbose && window && window.console) {
|
4604
|
+
console.log(user);
|
4605
|
+
}
|
4606
|
+
}
|
4623
4607
|
onnotification(notification) {
|
4624
4608
|
if (this.verbose && window && window.console) {
|
4625
4609
|
console.log(notification);
|
@@ -4685,6 +4669,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4685
4669
|
console.log("Heartbeat timeout.");
|
4686
4670
|
}
|
4687
4671
|
}
|
4672
|
+
oncustomstatus(statusEvent) {
|
4673
|
+
if (this.verbose && window && window.console) {
|
4674
|
+
console.log(statusEvent);
|
4675
|
+
}
|
4676
|
+
}
|
4688
4677
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
4689
4678
|
const untypedMessage = message;
|
4690
4679
|
return new Promise((resolve, reject) => {
|
@@ -4836,6 +4825,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4836
4825
|
return response.voice_leaved_event;
|
4837
4826
|
});
|
4838
4827
|
}
|
4828
|
+
writeCustomStatus(clan_id, status) {
|
4829
|
+
return __async(this, null, function* () {
|
4830
|
+
const response = yield this.send({ custom_status_event: { clan_id, status } });
|
4831
|
+
return response.custom_status_event;
|
4832
|
+
});
|
4833
|
+
}
|
4839
4834
|
pingPong() {
|
4840
4835
|
return __async(this, null, function* () {
|
4841
4836
|
if (!this.adapter.isOpen()) {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -2358,32 +2358,7 @@ var MezonApi = class {
|
|
2358
2358
|
)
|
2359
2359
|
]);
|
2360
2360
|
}
|
2361
|
-
/**
|
2362
|
-
listClanEmoji(bearerToken, options = {}) {
|
2363
|
-
const urlPath = "/v2/emoji";
|
2364
|
-
const queryParams = /* @__PURE__ */ new Map();
|
2365
|
-
let bodyJson = "";
|
2366
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2367
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2368
|
-
if (bearerToken) {
|
2369
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2370
|
-
}
|
2371
|
-
return Promise.race([
|
2372
|
-
fetch(fullUrl, fetchOptions).then((response) => {
|
2373
|
-
if (response.status == 204) {
|
2374
|
-
return response;
|
2375
|
-
} else if (response.status >= 200 && response.status < 300) {
|
2376
|
-
return response.json();
|
2377
|
-
} else {
|
2378
|
-
throw response;
|
2379
|
-
}
|
2380
|
-
}),
|
2381
|
-
new Promise(
|
2382
|
-
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2383
|
-
)
|
2384
|
-
]);
|
2385
|
-
}
|
2386
|
-
/** Post permission Emoji /v2/emoji/create */
|
2361
|
+
/** Post clan Emoji /v2/emoji/create */
|
2387
2362
|
createClanEmoji(bearerToken, body, options = {}) {
|
2388
2363
|
if (body === null || body === void 0) {
|
2389
2364
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
@@ -4509,6 +4484,10 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4509
4484
|
this.onchannelpresence(message.channel_presence_event);
|
4510
4485
|
} else if (message.last_pin_message_event) {
|
4511
4486
|
this.onpinmessage(message.last_pin_message_event);
|
4487
|
+
} else if (message.custom_status_event) {
|
4488
|
+
this.oncustomstatus(message.custom_status_event);
|
4489
|
+
} else if (message.user_channel_added_event) {
|
4490
|
+
this.onuserchanneladded(message.user_channel_added_event);
|
4512
4491
|
} else {
|
4513
4492
|
if (this.verbose && window && window.console) {
|
4514
4493
|
console.log("Unrecognized message received: %o", message);
|
@@ -4591,6 +4570,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4591
4570
|
console.log(channelPresence);
|
4592
4571
|
}
|
4593
4572
|
}
|
4573
|
+
onuserchanneladded(user) {
|
4574
|
+
if (this.verbose && window && window.console) {
|
4575
|
+
console.log(user);
|
4576
|
+
}
|
4577
|
+
}
|
4594
4578
|
onnotification(notification) {
|
4595
4579
|
if (this.verbose && window && window.console) {
|
4596
4580
|
console.log(notification);
|
@@ -4656,6 +4640,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4656
4640
|
console.log("Heartbeat timeout.");
|
4657
4641
|
}
|
4658
4642
|
}
|
4643
|
+
oncustomstatus(statusEvent) {
|
4644
|
+
if (this.verbose && window && window.console) {
|
4645
|
+
console.log(statusEvent);
|
4646
|
+
}
|
4647
|
+
}
|
4659
4648
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
4660
4649
|
const untypedMessage = message;
|
4661
4650
|
return new Promise((resolve, reject) => {
|
@@ -4807,6 +4796,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4807
4796
|
return response.voice_leaved_event;
|
4808
4797
|
});
|
4809
4798
|
}
|
4799
|
+
writeCustomStatus(clan_id, status) {
|
4800
|
+
return __async(this, null, function* () {
|
4801
|
+
const response = yield this.send({ custom_status_event: { clan_id, status } });
|
4802
|
+
return response.custom_status_event;
|
4803
|
+
});
|
4804
|
+
}
|
4810
4805
|
pingPong() {
|
4811
4806
|
return __async(this, null, function* () {
|
4812
4807
|
if (!this.adapter.isOpen()) {
|
package/dist/socket.d.ts
CHANGED
@@ -71,6 +71,14 @@ interface ChannelLeave {
|
|
71
71
|
channel_label: string;
|
72
72
|
};
|
73
73
|
}
|
74
|
+
/** UserChannelAddedEvent */
|
75
|
+
export interface UserChannelAddedEvent {
|
76
|
+
channel_id: string;
|
77
|
+
user_id: string;
|
78
|
+
username: string;
|
79
|
+
avatar: string;
|
80
|
+
status: string;
|
81
|
+
}
|
74
82
|
/** Last seen message by user */
|
75
83
|
export interface LastPinMessageEvent {
|
76
84
|
/** The channel this message belongs to. */
|
@@ -285,6 +293,12 @@ export interface VoiceJoinedEvent {
|
|
285
293
|
voice_channel_id: string;
|
286
294
|
last_screenshot: string;
|
287
295
|
}
|
296
|
+
export interface CustomStatusEvent {
|
297
|
+
clan_id: string;
|
298
|
+
user_id: string;
|
299
|
+
username: string;
|
300
|
+
status: string;
|
301
|
+
}
|
288
302
|
export interface ChannelUpdatedEvent {
|
289
303
|
clan_id: string;
|
290
304
|
category_id: string;
|
@@ -417,6 +431,8 @@ export interface Socket {
|
|
417
431
|
writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
|
418
432
|
/** Send last pin message */
|
419
433
|
writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string, operation: number): Promise<LastPinMessageEvent>;
|
434
|
+
/** Send custom user status */
|
435
|
+
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
420
436
|
/** send voice joined */
|
421
437
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
422
438
|
/** send voice leaved */
|
@@ -440,6 +456,7 @@ export interface Socket {
|
|
440
456
|
* In any case, be aware that `onclose` will still fire if there is a heartbeat timeout in a potentially delayed manner.
|
441
457
|
*/
|
442
458
|
onheartbeattimeout: () => void;
|
459
|
+
oncustomstatus: (statusEvent: CustomStatusEvent) => void;
|
443
460
|
/** Receive channel message. */
|
444
461
|
onchannelmessage: (channelMessage: ChannelMessageEvent) => void;
|
445
462
|
/** Receive typing event */
|
@@ -450,6 +467,8 @@ export interface Socket {
|
|
450
467
|
onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
|
451
468
|
/** pin message event */
|
452
469
|
onpinmessage: (pin: LastPinMessageEvent) => void;
|
470
|
+
/** Receive added user event */
|
471
|
+
onuserchanneladded: (user: UserChannelAddedEvent) => void;
|
453
472
|
onvoicestarted: (voice: VoiceStartedEvent) => void;
|
454
473
|
onvoiceended: (voice: VoiceEndedEvent) => void;
|
455
474
|
onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
|
@@ -493,6 +512,7 @@ export declare class DefaultSocket implements Socket {
|
|
493
512
|
onmessagereaction(messagereaction: MessageReactionEvent): void;
|
494
513
|
onchannelmessage(channelMessage: ChannelMessageEvent): void;
|
495
514
|
onchannelpresence(channelPresence: ChannelPresenceEvent): void;
|
515
|
+
onuserchanneladded(user: UserChannelAddedEvent): void;
|
496
516
|
onnotification(notification: Notification): void;
|
497
517
|
onstatuspresence(statusPresence: StatusPresenceEvent): void;
|
498
518
|
onpinmessage(pin: LastPinMessageEvent): void;
|
@@ -506,7 +526,8 @@ export declare class DefaultSocket implements Socket {
|
|
506
526
|
onstreampresence(streamPresence: StreamPresenceEvent): void;
|
507
527
|
onstreamdata(streamData: StreamData): void;
|
508
528
|
onheartbeattimeout(): void;
|
509
|
-
|
529
|
+
oncustomstatus(statusEvent: CustomStatusEvent): void;
|
530
|
+
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
510
531
|
followUsers(userIds: string[]): Promise<Status>;
|
511
532
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
512
533
|
joinChat(clan_id: string, channel_id: string, mode: number, type: number, persistence: boolean, hidden: boolean): Promise<Channel>;
|
@@ -525,6 +546,7 @@ export declare class DefaultSocket implements Socket {
|
|
525
546
|
writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string, operation: number): Promise<LastPinMessageEvent>;
|
526
547
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
527
548
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
549
|
+
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
528
550
|
private pingPong;
|
529
551
|
}
|
530
552
|
export {};
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -88,6 +88,20 @@ interface ChannelLeave {
|
|
88
88
|
};
|
89
89
|
}
|
90
90
|
|
91
|
+
/** UserChannelAddedEvent */
|
92
|
+
export interface UserChannelAddedEvent {
|
93
|
+
// the channel id
|
94
|
+
channel_id: string;
|
95
|
+
// the user_id
|
96
|
+
user_id: string;
|
97
|
+
// the username
|
98
|
+
username: string;
|
99
|
+
// the avatar
|
100
|
+
avatar: string;
|
101
|
+
// the custom status
|
102
|
+
status: string;
|
103
|
+
}
|
104
|
+
|
91
105
|
/** Last seen message by user */
|
92
106
|
export interface LastPinMessageEvent {
|
93
107
|
/** The channel this message belongs to. */
|
@@ -395,6 +409,16 @@ export interface VoiceJoinedEvent {
|
|
395
409
|
last_screenshot: string;
|
396
410
|
}
|
397
411
|
|
412
|
+
export interface CustomStatusEvent {
|
413
|
+
// the clan id
|
414
|
+
clan_id: string;
|
415
|
+
// the user id
|
416
|
+
user_id: string;
|
417
|
+
// username
|
418
|
+
username: string;
|
419
|
+
// the status
|
420
|
+
status: string;
|
421
|
+
}
|
398
422
|
|
399
423
|
export interface ChannelUpdatedEvent {
|
400
424
|
// clan id
|
@@ -574,6 +598,9 @@ export interface Socket {
|
|
574
598
|
/** Send last pin message */
|
575
599
|
writeLastPinMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp: string, operation: number) : Promise<LastPinMessageEvent>;
|
576
600
|
|
601
|
+
/** Send custom user status */
|
602
|
+
writeCustomStatus(clan_id: string, status: string) : Promise<CustomStatusEvent>;
|
603
|
+
|
577
604
|
/** send voice joined */
|
578
605
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string) : Promise<VoiceJoinedEvent>;
|
579
606
|
|
@@ -606,6 +633,8 @@ export interface Socket {
|
|
606
633
|
*/
|
607
634
|
onheartbeattimeout: () => void;
|
608
635
|
|
636
|
+
oncustomstatus: (statusEvent: CustomStatusEvent) => void;
|
637
|
+
|
609
638
|
/** Receive channel message. */
|
610
639
|
onchannelmessage: (channelMessage: ChannelMessageEvent) => void;
|
611
640
|
|
@@ -620,6 +649,9 @@ export interface Socket {
|
|
620
649
|
|
621
650
|
/** pin message event */
|
622
651
|
onpinmessage: (pin: LastPinMessageEvent) => void;
|
652
|
+
|
653
|
+
/** Receive added user event */
|
654
|
+
onuserchanneladded: (user: UserChannelAddedEvent) => void;
|
623
655
|
|
624
656
|
// when someone start the voice room
|
625
657
|
onvoicestarted: (voice: VoiceStartedEvent) => void;
|
@@ -774,6 +806,10 @@ export class DefaultSocket implements Socket {
|
|
774
806
|
this.onchannelpresence(<ChannelPresenceEvent>message.channel_presence_event);
|
775
807
|
} else if (message.last_pin_message_event) {
|
776
808
|
this.onpinmessage(<LastPinMessageEvent>message.last_pin_message_event);
|
809
|
+
} else if (message.custom_status_event) {
|
810
|
+
this.oncustomstatus(<CustomStatusEvent>message.custom_status_event);
|
811
|
+
} else if (message.user_channel_added_event) {
|
812
|
+
this.onuserchanneladded(<UserChannelAddedEvent>message.user_channel_added_event);
|
777
813
|
} else {
|
778
814
|
if (this.verbose && window && window.console) {
|
779
815
|
console.log("Unrecognized message received: %o", message);
|
@@ -871,6 +907,12 @@ export class DefaultSocket implements Socket {
|
|
871
907
|
}
|
872
908
|
}
|
873
909
|
|
910
|
+
onuserchanneladded(user: UserChannelAddedEvent) {
|
911
|
+
if (this.verbose && window && window.console) {
|
912
|
+
console.log(user);
|
913
|
+
}
|
914
|
+
}
|
915
|
+
|
874
916
|
onnotification(notification: Notification) {
|
875
917
|
if (this.verbose && window && window.console) {
|
876
918
|
console.log(notification);
|
@@ -949,7 +991,13 @@ export class DefaultSocket implements Socket {
|
|
949
991
|
}
|
950
992
|
}
|
951
993
|
|
952
|
-
|
994
|
+
oncustomstatus(statusEvent: CustomStatusEvent) {
|
995
|
+
if (this.verbose && window && window.console) {
|
996
|
+
console.log(statusEvent);
|
997
|
+
}
|
998
|
+
}
|
999
|
+
|
1000
|
+
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
|
953
1001
|
ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
|
954
1002
|
const untypedMessage = message as any;
|
955
1003
|
|
@@ -1101,6 +1149,11 @@ export class DefaultSocket implements Socket {
|
|
1101
1149
|
return response.voice_leaved_event
|
1102
1150
|
}
|
1103
1151
|
|
1152
|
+
async writeCustomStatus(clan_id: string, status: string) : Promise<CustomStatusEvent> {
|
1153
|
+
const response = await this.send({custom_status_event: {clan_id: clan_id, status: status}});
|
1154
|
+
return response.custom_status_event
|
1155
|
+
}
|
1156
|
+
|
1104
1157
|
private async pingPong() : Promise<void> {
|
1105
1158
|
if (!this.adapter.isOpen()) {
|
1106
1159
|
return;
|