mezon-js 2.7.8 → 2.7.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -3558,30 +3558,36 @@ var _DefaultSocket = class _DefaultSocket {
3558
3558
  } else if (message.stream_data) {
3559
3559
  this.onstreamdata(message.stream_data);
3560
3560
  } else if (message.channel_message) {
3561
+ var content, reactions, mentions, attachments, references;
3561
3562
  try {
3562
- var e = {
3563
- avatar: message.channel_message.avatar,
3564
- channel_id: message.channel_message.channel_id,
3565
- mode: message.channel_message.mode,
3566
- channel_label: message.channel_message.channel_label,
3567
- clan_id: message.channel_message.clan_id,
3568
- code: message.channel_message.code,
3569
- content: JSON.parse(message.channel_message.content),
3570
- create_time: message.channel_message.create_time,
3571
- id: message.channel_message.message_id,
3572
- sender_id: message.channel_message.sender_id,
3573
- update_time: message.channel_message.update_time,
3574
- user_id_one: message.channel_message.user_id_one,
3575
- user_id_two: message.channel_message.user_id_two,
3576
- username: message.channel_message.username,
3577
- reactions: JSON.parse(message.channel_message.reactions),
3578
- mentions: JSON.parse(message.channel_message.mentions),
3579
- attachments: JSON.parse(message.channel_message.attachments),
3580
- references: JSON.parse(message.channel_message.references)
3581
- };
3582
- this.onchannelmessage(e);
3563
+ content = JSON.parse(message.channel_message.content);
3564
+ reactions = JSON.parse(message.channel_message.reactions);
3565
+ mentions = JSON.parse(message.channel_message.mentions);
3566
+ attachments = JSON.parse(message.channel_message.attachments);
3567
+ references = JSON.parse(message.channel_message.references);
3583
3568
  } catch (e2) {
3584
3569
  }
3570
+ var e = {
3571
+ avatar: message.channel_message.avatar,
3572
+ channel_id: message.channel_message.channel_id,
3573
+ mode: message.channel_message.mode,
3574
+ channel_label: message.channel_message.channel_label,
3575
+ clan_id: message.channel_message.clan_id,
3576
+ code: message.channel_message.code,
3577
+ create_time: message.channel_message.create_time,
3578
+ id: message.channel_message.message_id,
3579
+ sender_id: message.channel_message.sender_id,
3580
+ update_time: message.channel_message.update_time,
3581
+ user_id_one: message.channel_message.user_id_one,
3582
+ user_id_two: message.channel_message.user_id_two,
3583
+ username: message.channel_message.username,
3584
+ content,
3585
+ reactions,
3586
+ mentions,
3587
+ attachments,
3588
+ references
3589
+ };
3590
+ this.onchannelmessage(e);
3585
3591
  } else if (message.message_typing_event) {
3586
3592
  this.onmessagetyping(message.message_typing_event);
3587
3593
  } else if (message.message_reaction_event) {
@@ -3530,30 +3530,36 @@ var _DefaultSocket = class _DefaultSocket {
3530
3530
  } else if (message.stream_data) {
3531
3531
  this.onstreamdata(message.stream_data);
3532
3532
  } else if (message.channel_message) {
3533
+ var content, reactions, mentions, attachments, references;
3533
3534
  try {
3534
- var e = {
3535
- avatar: message.channel_message.avatar,
3536
- channel_id: message.channel_message.channel_id,
3537
- mode: message.channel_message.mode,
3538
- channel_label: message.channel_message.channel_label,
3539
- clan_id: message.channel_message.clan_id,
3540
- code: message.channel_message.code,
3541
- content: JSON.parse(message.channel_message.content),
3542
- create_time: message.channel_message.create_time,
3543
- id: message.channel_message.message_id,
3544
- sender_id: message.channel_message.sender_id,
3545
- update_time: message.channel_message.update_time,
3546
- user_id_one: message.channel_message.user_id_one,
3547
- user_id_two: message.channel_message.user_id_two,
3548
- username: message.channel_message.username,
3549
- reactions: JSON.parse(message.channel_message.reactions),
3550
- mentions: JSON.parse(message.channel_message.mentions),
3551
- attachments: JSON.parse(message.channel_message.attachments),
3552
- references: JSON.parse(message.channel_message.references)
3553
- };
3554
- this.onchannelmessage(e);
3535
+ content = JSON.parse(message.channel_message.content);
3536
+ reactions = JSON.parse(message.channel_message.reactions);
3537
+ mentions = JSON.parse(message.channel_message.mentions);
3538
+ attachments = JSON.parse(message.channel_message.attachments);
3539
+ references = JSON.parse(message.channel_message.references);
3555
3540
  } catch (e2) {
3556
3541
  }
3542
+ var e = {
3543
+ avatar: message.channel_message.avatar,
3544
+ channel_id: message.channel_message.channel_id,
3545
+ mode: message.channel_message.mode,
3546
+ channel_label: message.channel_message.channel_label,
3547
+ clan_id: message.channel_message.clan_id,
3548
+ code: message.channel_message.code,
3549
+ create_time: message.channel_message.create_time,
3550
+ id: message.channel_message.message_id,
3551
+ sender_id: message.channel_message.sender_id,
3552
+ update_time: message.channel_message.update_time,
3553
+ user_id_one: message.channel_message.user_id_one,
3554
+ user_id_two: message.channel_message.user_id_two,
3555
+ username: message.channel_message.username,
3556
+ content,
3557
+ reactions,
3558
+ mentions,
3559
+ attachments,
3560
+ references
3561
+ };
3562
+ this.onchannelmessage(e);
3557
3563
  } else if (message.message_typing_event) {
3558
3564
  this.onmessagetyping(message.message_typing_event);
3559
3565
  } else if (message.message_reaction_event) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.8",
3
+ "version": "2.7.9",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -884,32 +884,38 @@ export class DefaultSocket implements Socket {
884
884
  this.onstreampresence(<StreamPresenceEvent>message.stream_presence_event);
885
885
  } else if (message.stream_data) {
886
886
  this.onstreamdata(<StreamData>message.stream_data);
887
- } else if (message.channel_message) {
888
- try {
889
- var e: ChannelMessageEvent = {
890
- avatar: message.channel_message.avatar,
891
- channel_id: message.channel_message.channel_id,
892
- mode: message.channel_message.mode,
893
- channel_label: message.channel_message.channel_label,
894
- clan_id: message.channel_message.clan_id,
895
- code: message.channel_message.code,
896
- content: JSON.parse(message.channel_message.content),
897
- create_time: message.channel_message.create_time,
898
- id: message.channel_message.message_id,
899
- sender_id: message.channel_message.sender_id,
900
- update_time: message.channel_message.update_time,
901
- user_id_one: message.channel_message.user_id_one,
902
- user_id_two: message.channel_message.user_id_two,
903
- username: message.channel_message.username,
904
- reactions: JSON.parse(message.channel_message.reactions),
905
- mentions: JSON.parse(message.channel_message.mentions),
906
- attachments: JSON.parse(message.channel_message.attachments),
907
- references: JSON.parse(message.channel_message.references)
908
- };
909
- this.onchannelmessage(e);
887
+ } else if (message.channel_message) {
888
+ var content, reactions, mentions, attachments, references;
889
+ try {
890
+ content = JSON.parse(message.channel_message.content);
891
+ reactions = JSON.parse(message.channel_message.reactions);
892
+ mentions = JSON.parse(message.channel_message.mentions);
893
+ attachments = JSON.parse(message.channel_message.attachments);
894
+ references = JSON.parse(message.channel_message.references);
910
895
  } catch(e) {
911
896
  //console.log("error parse data", e);
912
- }
897
+ }
898
+ var e: ChannelMessageEvent = {
899
+ avatar: message.channel_message.avatar,
900
+ channel_id: message.channel_message.channel_id,
901
+ mode: message.channel_message.mode,
902
+ channel_label: message.channel_message.channel_label,
903
+ clan_id: message.channel_message.clan_id,
904
+ code: message.channel_message.code,
905
+ create_time: message.channel_message.create_time,
906
+ id: message.channel_message.message_id,
907
+ sender_id: message.channel_message.sender_id,
908
+ update_time: message.channel_message.update_time,
909
+ user_id_one: message.channel_message.user_id_one,
910
+ user_id_two: message.channel_message.user_id_two,
911
+ username: message.channel_message.username,
912
+ content: content,
913
+ reactions: reactions,
914
+ mentions: mentions,
915
+ attachments: attachments,
916
+ references: references,
917
+ };
918
+ this.onchannelmessage(e);
913
919
  } else if (message.message_typing_event) {
914
920
  this.onmessagetyping(<MessageTypingEvent>message.message_typing_event);
915
921
  } else if (message.message_reaction_event) {