mezon-js 2.8.13 → 2.8.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -4753,18 +4753,29 @@ var _DefaultSocket = class _DefaultSocket {
4753
4753
  } else if (message.channel_message) {
4754
4754
  var content, reactions, mentions, attachments, references;
4755
4755
  try {
4756
- if (content)
4757
- content = JSON.parse(message.channel_message.content);
4758
- if (reactions)
4759
- reactions = JSON.parse(message.channel_message.reactions);
4760
- if (mentions)
4761
- mentions = JSON.parse(message.channel_message.mentions);
4762
- if (attachments)
4763
- attachments = JSON.parse(message.channel_message.attachments);
4764
- if (references)
4765
- references = JSON.parse(message.channel_message.references);
4756
+ content = JSON.parse(message.channel_message.content);
4766
4757
  } catch (e2) {
4767
- console.log("error parse data", e2);
4758
+ console.log("content is invalid", e2);
4759
+ }
4760
+ try {
4761
+ reactions = JSON.parse(message.channel_message.reactions);
4762
+ } catch (e2) {
4763
+ console.log("reactions is invalid", e2);
4764
+ }
4765
+ try {
4766
+ mentions = JSON.parse(message.channel_message.mentions);
4767
+ } catch (e2) {
4768
+ console.log("mentions is invalid", e2);
4769
+ }
4770
+ try {
4771
+ attachments = JSON.parse(message.channel_message.attachments);
4772
+ } catch (e2) {
4773
+ console.log("attachments is invalid", e2);
4774
+ }
4775
+ try {
4776
+ references = JSON.parse(message.channel_message.references);
4777
+ } catch (e2) {
4778
+ console.log("references is invalid", e2);
4768
4779
  }
4769
4780
  var e = {
4770
4781
  avatar: message.channel_message.avatar,
@@ -4724,18 +4724,29 @@ var _DefaultSocket = class _DefaultSocket {
4724
4724
  } else if (message.channel_message) {
4725
4725
  var content, reactions, mentions, attachments, references;
4726
4726
  try {
4727
- if (content)
4728
- content = JSON.parse(message.channel_message.content);
4729
- if (reactions)
4730
- reactions = JSON.parse(message.channel_message.reactions);
4731
- if (mentions)
4732
- mentions = JSON.parse(message.channel_message.mentions);
4733
- if (attachments)
4734
- attachments = JSON.parse(message.channel_message.attachments);
4735
- if (references)
4736
- references = JSON.parse(message.channel_message.references);
4727
+ content = JSON.parse(message.channel_message.content);
4737
4728
  } catch (e2) {
4738
- console.log("error parse data", e2);
4729
+ console.log("content is invalid", e2);
4730
+ }
4731
+ try {
4732
+ reactions = JSON.parse(message.channel_message.reactions);
4733
+ } catch (e2) {
4734
+ console.log("reactions is invalid", e2);
4735
+ }
4736
+ try {
4737
+ mentions = JSON.parse(message.channel_message.mentions);
4738
+ } catch (e2) {
4739
+ console.log("mentions is invalid", e2);
4740
+ }
4741
+ try {
4742
+ attachments = JSON.parse(message.channel_message.attachments);
4743
+ } catch (e2) {
4744
+ console.log("attachments is invalid", e2);
4745
+ }
4746
+ try {
4747
+ references = JSON.parse(message.channel_message.references);
4748
+ } catch (e2) {
4749
+ console.log("references is invalid", e2);
4739
4750
  }
4740
4751
  var e = {
4741
4752
  avatar: message.channel_message.avatar,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.13",
3
+ "version": "2.8.14",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -872,19 +872,30 @@ export class DefaultSocket implements Socket {
872
872
  this.onstreamdata(<StreamData>message.stream_data);
873
873
  } else if (message.channel_message) {
874
874
  var content, reactions, mentions, attachments, references;
875
+ try {
876
+ content = JSON.parse(message.channel_message.content);
877
+ } catch(e) {
878
+ console.log("content is invalid", e)
879
+ }
880
+ try {
881
+ reactions = JSON.parse(message.channel_message.reactions);
882
+ } catch(e) {
883
+ console.log("reactions is invalid", e)
884
+ }
885
+ try {
886
+ mentions = JSON.parse(message.channel_message.mentions);
887
+ } catch(e) {
888
+ console.log("mentions is invalid", e)
889
+ }
890
+ try {
891
+ attachments = JSON.parse(message.channel_message.attachments);
892
+ } catch(e) {
893
+ console.log("attachments is invalid", e)
894
+ }
875
895
  try {
876
- if (content)
877
- content = JSON.parse(message.channel_message.content);
878
- if (reactions)
879
- reactions = JSON.parse(message.channel_message.reactions);
880
- if (mentions)
881
- mentions = JSON.parse(message.channel_message.mentions);
882
- if (attachments)
883
- attachments = JSON.parse(message.channel_message.attachments);
884
- if (references)
885
- references = JSON.parse(message.channel_message.references);
896
+ references = JSON.parse(message.channel_message.references);
886
897
  } catch(e) {
887
- console.log("error parse data", e);
898
+ console.log("references is invalid", e);
888
899
  }
889
900
  var e: ChannelMessageEvent = {
890
901
  avatar: message.channel_message.avatar,
package/dist/dist.zip DELETED
Binary file