mezon-js 2.7.8 → 2.7.10

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.8",
3
+ "version": "2.7.10",
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) {