mezon-js 2.9.57 → 2.9.60

Sign up to get free protection for your applications and to get access to all the features.
package/client.ts CHANGED
@@ -1399,27 +1399,27 @@ export class Client {
1399
1399
  try {
1400
1400
  content = JSON.parse(m.content);
1401
1401
  } catch (e) {
1402
- //console.log("error parse content", e);
1402
+ console.log("error parse content", e);
1403
1403
  }
1404
1404
  try {
1405
1405
  reactions = JSON.parse(m.reactions || "[]");
1406
1406
  } catch (e) {
1407
- //console.log("error parse reactions", e);
1407
+ console.log("error parse reactions", e);
1408
1408
  }
1409
1409
  try {
1410
1410
  mentions = JSON.parse(m.mentions || "[]");
1411
1411
  } catch (e) {
1412
- //console.log("error parse mentions", e);
1412
+ console.log("error parse mentions", e);
1413
1413
  }
1414
1414
  try {
1415
1415
  attachments = JSON.parse(m.attachments || "[]");
1416
1416
  } catch (e) {
1417
- //console.log("error parse attachments", e);
1417
+ console.log("error parse attachments", e);
1418
1418
  }
1419
1419
  try {
1420
1420
  references = JSON.parse(m.references || "[]");
1421
1421
  } catch (e) {
1422
- //console.log("error parse references", e);
1422
+ console.log("error parse references", e);
1423
1423
  }
1424
1424
  result.messages!.push({
1425
1425
  channel_id: m.channel_id,
@@ -6293,22 +6293,27 @@ var _DefaultSocket = class _DefaultSocket {
6293
6293
  try {
6294
6294
  content = JSON.parse(message.channel_message.content);
6295
6295
  } catch (e2) {
6296
+ console.log("content is invalid", e2);
6296
6297
  }
6297
6298
  try {
6298
6299
  reactions = JSON.parse(message.channel_message.reactions);
6299
6300
  } catch (e2) {
6301
+ console.log("reactions is invalid", e2);
6300
6302
  }
6301
6303
  try {
6302
6304
  mentions = JSON.parse(message.channel_message.mentions);
6303
6305
  } catch (e2) {
6306
+ console.log("mentions is invalid", e2);
6304
6307
  }
6305
6308
  try {
6306
6309
  attachments = JSON.parse(message.channel_message.attachments);
6307
6310
  } catch (e2) {
6311
+ console.log("attachments is invalid", e2);
6308
6312
  }
6309
6313
  try {
6310
6314
  references = JSON.parse(message.channel_message.references);
6311
6315
  } catch (e2) {
6316
+ console.log("references is invalid", e2);
6312
6317
  }
6313
6318
  var e = {
6314
6319
  id: message.id || message.channel_message.message_id,
@@ -6373,10 +6378,12 @@ var _DefaultSocket = class _DefaultSocket {
6373
6378
  this.onstreamingchanneljoined(message.streaming_joined_event);
6374
6379
  } else if (message.streaming_leaved_event) {
6375
6380
  this.onstreamingchannelleaved(message.streaming_leaved_event);
6376
- } else if (message.set_permission_channel_event) {
6377
- this.onsetpermissionchannel(message.set_permission_channel_event);
6378
- } else if (message.event_user_permission_channel) {
6379
- this.onuserpermissionchannel(message.event_user_permission_channel);
6381
+ } else if (message.permission_set_event) {
6382
+ this.onpermissionset(message.permission_set_event);
6383
+ } else if (message.permission_changed_event) {
6384
+ this.onpermissionchanged(message.permission_changed_event);
6385
+ } else if (message.token_sent_event) {
6386
+ this.ontokensent(message.token_sent_event);
6380
6387
  } else {
6381
6388
  if (this.verbose && window && window.console) {
6382
6389
  console.log("Unrecognized message received: %o", message);
@@ -6634,14 +6641,19 @@ var _DefaultSocket = class _DefaultSocket {
6634
6641
  console.log(streaming_leaved_event);
6635
6642
  }
6636
6643
  }
6637
- onsetpermissionchannel(set_permission_channel_event) {
6644
+ onpermissionset(permission_set_event) {
6638
6645
  if (this.verbose && window && window.console) {
6639
- console.log(set_permission_channel_event);
6646
+ console.log(permission_set_event);
6640
6647
  }
6641
6648
  }
6642
- onuserpermissionchannel(event_user_permission_channel) {
6649
+ onpermissionchanged(permission_changed_event) {
6643
6650
  if (this.verbose && window && window.console) {
6644
- console.log(event_user_permission_channel);
6651
+ console.log(permission_changed_event);
6652
+ }
6653
+ }
6654
+ ontokensent(tokenSentEvent) {
6655
+ if (this.verbose && window && window.console) {
6656
+ console.log(tokenSentEvent);
6645
6657
  }
6646
6658
  }
6647
6659
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
@@ -6795,6 +6807,12 @@ var _DefaultSocket = class _DefaultSocket {
6795
6807
  return response.check_name_existed_event;
6796
6808
  });
6797
6809
  }
6810
+ sendToken(receiver_id, amount) {
6811
+ return __async(this, null, function* () {
6812
+ const response = yield this.send({ token_sent_event: { receiver_id, amount } });
6813
+ return response.token_sent_event;
6814
+ });
6815
+ }
6798
6816
  pingPong() {
6799
6817
  return __async(this, null, function* () {
6800
6818
  if (!this.adapter.isOpen()) {
@@ -7398,22 +7416,27 @@ var Client = class {
7398
7416
  try {
7399
7417
  content = JSON.parse(m.content);
7400
7418
  } catch (e) {
7419
+ console.log("error parse content", e);
7401
7420
  }
7402
7421
  try {
7403
7422
  reactions = JSON.parse(m.reactions || "[]");
7404
7423
  } catch (e) {
7424
+ console.log("error parse reactions", e);
7405
7425
  }
7406
7426
  try {
7407
7427
  mentions = JSON.parse(m.mentions || "[]");
7408
7428
  } catch (e) {
7429
+ console.log("error parse mentions", e);
7409
7430
  }
7410
7431
  try {
7411
7432
  attachments = JSON.parse(m.attachments || "[]");
7412
7433
  } catch (e) {
7434
+ console.log("error parse attachments", e);
7413
7435
  }
7414
7436
  try {
7415
7437
  references = JSON.parse(m.references || "[]");
7416
7438
  } catch (e) {
7439
+ console.log("error parse references", e);
7417
7440
  }
7418
7441
  result.messages.push({
7419
7442
  channel_id: m.channel_id,
@@ -6264,22 +6264,27 @@ var _DefaultSocket = class _DefaultSocket {
6264
6264
  try {
6265
6265
  content = JSON.parse(message.channel_message.content);
6266
6266
  } catch (e2) {
6267
+ console.log("content is invalid", e2);
6267
6268
  }
6268
6269
  try {
6269
6270
  reactions = JSON.parse(message.channel_message.reactions);
6270
6271
  } catch (e2) {
6272
+ console.log("reactions is invalid", e2);
6271
6273
  }
6272
6274
  try {
6273
6275
  mentions = JSON.parse(message.channel_message.mentions);
6274
6276
  } catch (e2) {
6277
+ console.log("mentions is invalid", e2);
6275
6278
  }
6276
6279
  try {
6277
6280
  attachments = JSON.parse(message.channel_message.attachments);
6278
6281
  } catch (e2) {
6282
+ console.log("attachments is invalid", e2);
6279
6283
  }
6280
6284
  try {
6281
6285
  references = JSON.parse(message.channel_message.references);
6282
6286
  } catch (e2) {
6287
+ console.log("references is invalid", e2);
6283
6288
  }
6284
6289
  var e = {
6285
6290
  id: message.id || message.channel_message.message_id,
@@ -6344,10 +6349,12 @@ var _DefaultSocket = class _DefaultSocket {
6344
6349
  this.onstreamingchanneljoined(message.streaming_joined_event);
6345
6350
  } else if (message.streaming_leaved_event) {
6346
6351
  this.onstreamingchannelleaved(message.streaming_leaved_event);
6347
- } else if (message.set_permission_channel_event) {
6348
- this.onsetpermissionchannel(message.set_permission_channel_event);
6349
- } else if (message.event_user_permission_channel) {
6350
- this.onuserpermissionchannel(message.event_user_permission_channel);
6352
+ } else if (message.permission_set_event) {
6353
+ this.onpermissionset(message.permission_set_event);
6354
+ } else if (message.permission_changed_event) {
6355
+ this.onpermissionchanged(message.permission_changed_event);
6356
+ } else if (message.token_sent_event) {
6357
+ this.ontokensent(message.token_sent_event);
6351
6358
  } else {
6352
6359
  if (this.verbose && window && window.console) {
6353
6360
  console.log("Unrecognized message received: %o", message);
@@ -6605,14 +6612,19 @@ var _DefaultSocket = class _DefaultSocket {
6605
6612
  console.log(streaming_leaved_event);
6606
6613
  }
6607
6614
  }
6608
- onsetpermissionchannel(set_permission_channel_event) {
6615
+ onpermissionset(permission_set_event) {
6609
6616
  if (this.verbose && window && window.console) {
6610
- console.log(set_permission_channel_event);
6617
+ console.log(permission_set_event);
6611
6618
  }
6612
6619
  }
6613
- onuserpermissionchannel(event_user_permission_channel) {
6620
+ onpermissionchanged(permission_changed_event) {
6614
6621
  if (this.verbose && window && window.console) {
6615
- console.log(event_user_permission_channel);
6622
+ console.log(permission_changed_event);
6623
+ }
6624
+ }
6625
+ ontokensent(tokenSentEvent) {
6626
+ if (this.verbose && window && window.console) {
6627
+ console.log(tokenSentEvent);
6616
6628
  }
6617
6629
  }
6618
6630
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
@@ -6766,6 +6778,12 @@ var _DefaultSocket = class _DefaultSocket {
6766
6778
  return response.check_name_existed_event;
6767
6779
  });
6768
6780
  }
6781
+ sendToken(receiver_id, amount) {
6782
+ return __async(this, null, function* () {
6783
+ const response = yield this.send({ token_sent_event: { receiver_id, amount } });
6784
+ return response.token_sent_event;
6785
+ });
6786
+ }
6769
6787
  pingPong() {
6770
6788
  return __async(this, null, function* () {
6771
6789
  if (!this.adapter.isOpen()) {
@@ -7369,22 +7387,27 @@ var Client = class {
7369
7387
  try {
7370
7388
  content = JSON.parse(m.content);
7371
7389
  } catch (e) {
7390
+ console.log("error parse content", e);
7372
7391
  }
7373
7392
  try {
7374
7393
  reactions = JSON.parse(m.reactions || "[]");
7375
7394
  } catch (e) {
7395
+ console.log("error parse reactions", e);
7376
7396
  }
7377
7397
  try {
7378
7398
  mentions = JSON.parse(m.mentions || "[]");
7379
7399
  } catch (e) {
7400
+ console.log("error parse mentions", e);
7380
7401
  }
7381
7402
  try {
7382
7403
  attachments = JSON.parse(m.attachments || "[]");
7383
7404
  } catch (e) {
7405
+ console.log("error parse attachments", e);
7384
7406
  }
7385
7407
  try {
7386
7408
  references = JSON.parse(m.references || "[]");
7387
7409
  } catch (e) {
7410
+ console.log("error parse references", e);
7388
7411
  }
7389
7412
  result.messages.push({
7390
7413
  channel_id: m.channel_id,
package/dist/socket.d.ts CHANGED
@@ -556,7 +556,7 @@ export interface StreamingEndedEvent {
556
556
  /** channel id */
557
557
  channel_id: string;
558
558
  }
559
- export interface SetPermissionChannelEvent {
559
+ export interface PermissionSet {
560
560
  /** Role ID */
561
561
  role_id: string;
562
562
  /** User ID */
@@ -568,10 +568,16 @@ export interface SetPermissionChannelEvent {
568
568
  /** */
569
569
  caller: string;
570
570
  }
571
- export interface EventUserPermissionChannel {
571
+ export interface PermissionChangedEvent {
572
572
  user_id: string;
573
573
  channel_id: string;
574
574
  }
575
+ export interface TokenSentEvent {
576
+ sender_id: string;
577
+ sender_name: string;
578
+ receiver_id: string;
579
+ amount: number;
580
+ }
575
581
  /** A socket connection to Mezon server. */
576
582
  export interface Socket {
577
583
  /** Connection is Open */
@@ -614,6 +620,8 @@ export interface Socket {
614
620
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
615
621
  /** send voice leaved */
616
622
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
623
+ /** send token */
624
+ sendToken(receiver_id: string, amount: number): Promise<TokenSentEvent>;
617
625
  /** Handle disconnect events received from the socket. */
618
626
  ondisconnect: (evt: Event) => void;
619
627
  /** Handle error events received from the socket. */
@@ -680,8 +688,8 @@ export interface Socket {
680
688
  onstreamingchannelended: (streaming_ended_event: StreamingEndedEvent) => void;
681
689
  onstreamingchanneljoined: (streaming_joined_event: StreamingJoinedEvent) => void;
682
690
  onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
683
- onsetpermissionchannel: (set_permission_channel_event: SetPermissionChannelEvent) => void;
684
- onuserpermissionchannel: (event_user_permission_channel: EventUserPermissionChannel) => void;
691
+ onpermissionset: (permission_set_event: PermissionSet) => void;
692
+ onpermissionchanged: (permission_changed_event: PermissionChangedEvent) => void;
685
693
  }
686
694
  /** Reports an error received from a socket message. */
687
695
  export interface SocketError {
@@ -752,8 +760,9 @@ export declare class DefaultSocket implements Socket {
752
760
  onstreamingchannelended(streaming_ended_event: StreamingEndedEvent): void;
753
761
  onstreamingchanneljoined(streaming_joined_event: StreamingJoinedEvent): void;
754
762
  onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent): void;
755
- onsetpermissionchannel(set_permission_channel_event: SetPermissionChannelEvent): void;
756
- onuserpermissionchannel(event_user_permission_channel: EventUserPermissionChannel): void;
763
+ onpermissionset(permission_set_event: PermissionSet): void;
764
+ onpermissionchanged(permission_changed_event: PermissionChangedEvent): void;
765
+ ontokensent(tokenSentEvent: TokenSentEvent): void;
757
766
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
758
767
  followUsers(userIds: string[]): Promise<Status>;
759
768
  joinClanChat(clan_id: string): Promise<ClanJoin>;
@@ -773,6 +782,7 @@ export declare class DefaultSocket implements Socket {
773
782
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
774
783
  writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
775
784
  checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
785
+ sendToken(receiver_id: string, amount: number): Promise<TokenSentEvent>;
776
786
  private pingPong;
777
787
  }
778
788
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.57",
4
+ "version": "2.9.60",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -781,7 +781,7 @@ export interface StreamingEndedEvent {
781
781
  channel_id: string;
782
782
  }
783
783
 
784
- export interface SetPermissionChannelEvent {
784
+ export interface PermissionSet {
785
785
  /** Role ID */
786
786
  role_id: string;
787
787
  /** User ID */
@@ -794,11 +794,22 @@ export interface SetPermissionChannelEvent {
794
794
  caller: string;
795
795
  }
796
796
 
797
- export interface EventUserPermissionChannel{
797
+ export interface PermissionChangedEvent{
798
798
  user_id: string;
799
799
  channel_id: string;
800
800
  }
801
801
 
802
+ export interface TokenSentEvent {
803
+ // sender id
804
+ sender_id: string;
805
+ // sender name
806
+ sender_name: string;
807
+ // receiver
808
+ receiver_id: string;
809
+ // amount of token
810
+ amount: number;
811
+ }
812
+
802
813
  /** A socket connection to Mezon server. */
803
814
  export interface Socket {
804
815
  /** Connection is Open */
@@ -861,6 +872,9 @@ export interface Socket {
861
872
  /** send voice leaved */
862
873
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string) : Promise<VoiceLeavedEvent>;
863
874
 
875
+ /** send token */
876
+ sendToken(receiver_id: string, amount: number) : Promise<TokenSentEvent>;
877
+
864
878
  /** Handle disconnect events received from the socket. */
865
879
  ondisconnect: (evt: Event) => void;
866
880
 
@@ -987,9 +1001,9 @@ export interface Socket {
987
1001
 
988
1002
  onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
989
1003
 
990
- onsetpermissionchannel: (set_permission_channel_event: SetPermissionChannelEvent) => void;
1004
+ onpermissionset: (permission_set_event: PermissionSet) => void;
991
1005
 
992
- onuserpermissionchannel: (event_user_permission_channel: EventUserPermissionChannel) => void;
1006
+ onpermissionchanged: (permission_changed_event: PermissionChangedEvent) => void;
993
1007
  }
994
1008
 
995
1009
  /** Reports an error received from a socket message. */
@@ -1104,27 +1118,27 @@ export class DefaultSocket implements Socket {
1104
1118
  try {
1105
1119
  content = JSON.parse(message.channel_message.content);
1106
1120
  } catch(e) {
1107
- //console.log("content is invalid", e)
1121
+ console.log("content is invalid", e)
1108
1122
  }
1109
1123
  try {
1110
1124
  reactions = JSON.parse(message.channel_message.reactions);
1111
1125
  } catch(e) {
1112
- //console.log("reactions is invalid", e)
1126
+ console.log("reactions is invalid", e)
1113
1127
  }
1114
1128
  try {
1115
1129
  mentions = JSON.parse(message.channel_message.mentions);
1116
1130
  } catch(e) {
1117
- //console.log("mentions is invalid", e)
1131
+ console.log("mentions is invalid", e)
1118
1132
  }
1119
1133
  try {
1120
1134
  attachments = JSON.parse(message.channel_message.attachments);
1121
1135
  } catch(e) {
1122
- //console.log("attachments is invalid", e)
1136
+ console.log("attachments is invalid", e)
1123
1137
  }
1124
1138
  try {
1125
1139
  references = JSON.parse(message.channel_message.references);
1126
1140
  } catch(e) {
1127
- //console.log("references is invalid", e);
1141
+ console.log("references is invalid", e);
1128
1142
  }
1129
1143
  var e: ChannelMessage = {
1130
1144
  id: message.id || message.channel_message.message_id,
@@ -1189,10 +1203,12 @@ export class DefaultSocket implements Socket {
1189
1203
  this.onstreamingchanneljoined(<StreamingJoinedEvent>message.streaming_joined_event);
1190
1204
  } else if(message.streaming_leaved_event){
1191
1205
  this.onstreamingchannelleaved(<StreamingLeavedEvent>message.streaming_leaved_event);
1192
- } else if(message.set_permission_channel_event){
1193
- this.onsetpermissionchannel(<SetPermissionChannelEvent>message.set_permission_channel_event);
1194
- } else if(message.event_user_permission_channel){
1195
- this.onuserpermissionchannel(<EventUserPermissionChannel>message.event_user_permission_channel);
1206
+ } else if(message.permission_set_event){
1207
+ this.onpermissionset(<PermissionSet>message.permission_set_event);
1208
+ } else if(message.permission_changed_event){
1209
+ this.onpermissionchanged(<PermissionChangedEvent>message.permission_changed_event);
1210
+ } else if (message.token_sent_event) {
1211
+ this.ontokensent(<TokenSentEvent>message.token_sent_event);
1196
1212
  } else {
1197
1213
  if (this.verbose && window && window.console) {
1198
1214
  console.log("Unrecognized message received: %o", message);
@@ -1501,15 +1517,21 @@ export class DefaultSocket implements Socket {
1501
1517
  }
1502
1518
  }
1503
1519
 
1504
- onsetpermissionchannel(set_permission_channel_event: SetPermissionChannelEvent){
1520
+ onpermissionset(permission_set_event: PermissionSet){
1521
+ if (this.verbose && window && window.console) {
1522
+ console.log(permission_set_event);
1523
+ }
1524
+ }
1525
+
1526
+ onpermissionchanged(permission_changed_event: PermissionChangedEvent){
1505
1527
  if (this.verbose && window && window.console) {
1506
- console.log(set_permission_channel_event);
1528
+ console.log(permission_changed_event);
1507
1529
  }
1508
1530
  }
1509
1531
 
1510
- onuserpermissionchannel(event_user_permission_channel: EventUserPermissionChannel){
1532
+ ontokensent(tokenSentEvent: TokenSentEvent) {
1511
1533
  if (this.verbose && window && window.console) {
1512
- console.log(event_user_permission_channel);
1534
+ console.log(tokenSentEvent);
1513
1535
  }
1514
1536
  }
1515
1537
 
@@ -1625,42 +1647,47 @@ export class DefaultSocket implements Socket {
1625
1647
 
1626
1648
  async writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<ApiMessageReaction> {
1627
1649
  const response = await this.send({message_reaction_event: {id: id, clan_id: clan_id, channel_id: channel_id, mode: mode, is_public: is_public, message_id: message_id, emoji_id: emoji_id, emoji: emoji, count: count, message_sender_id: message_sender_id, action: action_delete}});
1628
- return response.message_reaction_event
1650
+ return response.message_reaction_event;
1629
1651
  }
1630
1652
 
1631
1653
  async writeMessageTyping(clan_id: string, channel_id: string, mode: number, is_public: boolean): Promise<MessageTypingEvent> {
1632
1654
  const response = await this.send({message_typing_event: {clan_id: clan_id, channel_id: channel_id, mode:mode, is_public: is_public}});
1633
- return response.message_typing_event
1655
+ return response.message_typing_event;
1634
1656
  }
1635
1657
 
1636
1658
  async writeLastSeenMessage(clan_id: string, channel_id: string, mode: number, message_id: string, timestamp_seconds: number): Promise<LastSeenMessageEvent> {
1637
1659
  const response = await this.send({last_seen_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, message_id: message_id, timestamp_seconds: timestamp_seconds}});
1638
- return response.last_seen_message_event
1660
+ return response.last_seen_message_event;
1639
1661
  }
1640
1662
 
1641
1663
  async writeLastPinMessage(clan_id: string, channel_id: string, mode: number, is_public: boolean, message_id: string, timestamp_seconds: number, operation: number): Promise<LastPinMessageEvent> {
1642
1664
  const response = await this.send({last_pin_message_event: {clan_id: clan_id, channel_id: channel_id, mode: mode, is_public: is_public, message_id: message_id, timestamp_seconds: timestamp_seconds, operation: operation}});
1643
- return response.last_pin_message_event
1665
+ return response.last_pin_message_event;
1644
1666
  }
1645
1667
 
1646
1668
  async writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent> {
1647
1669
  const response = await this.send({voice_joined_event: {clan_id: clanId, clan_name: clanName, id: id, participant: participant, voice_channel_id: voiceChannelId, voice_channel_label: voiceChannelLabel, last_screenshot: lastScreenshot}});
1648
- return response.voice_joined_event
1670
+ return response.voice_joined_event;
1649
1671
  }
1650
1672
 
1651
1673
  async writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent> {
1652
1674
  const response = await this.send({voice_leaved_event: {id: id, clan_id: clanId, voice_channel_id: voiceChannelId, voice_user_id: voiceUserId}});
1653
- return response.voice_leaved_event
1675
+ return response.voice_leaved_event;
1654
1676
  }
1655
1677
 
1656
1678
  async writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent> {
1657
1679
  const response = await this.send({custom_status_event: {clan_id: clan_id, status: status}});
1658
- return response.custom_status_event
1680
+ return response.custom_status_event;
1659
1681
  }
1660
1682
 
1661
1683
  async checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent> {
1662
1684
  const response = await this.send({check_name_existed_event: {name: name, condition_id: condition_id, type: type}});
1663
- return response.check_name_existed_event
1685
+ return response.check_name_existed_event;
1686
+ }
1687
+
1688
+ async sendToken(receiver_id: string, amount: number) : Promise<TokenSentEvent> {
1689
+ const response = await this.send({token_sent_event: {receiver_id: receiver_id, amount: amount}});
1690
+ return response.token_sent_event;
1664
1691
  }
1665
1692
 
1666
1693
  private async pingPong(): Promise<void> {