mezon-js 2.8.11 → 2.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.zip +0 -0
- package/dist/mezon-js.cjs.js +13 -7
- package/dist/mezon-js.esm.mjs +13 -7
- package/dist/socket.d.ts +6 -2
- package/package.json +1 -1
- package/socket.ts +21 -10
package/dist/dist.zip
ADDED
Binary file
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -4753,12 +4753,18 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4753
4753
|
} else if (message.channel_message) {
|
4754
4754
|
var content, reactions, mentions, attachments, references;
|
4755
4755
|
try {
|
4756
|
-
|
4757
|
-
|
4758
|
-
|
4759
|
-
|
4760
|
-
|
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);
|
4761
4766
|
} catch (e2) {
|
4767
|
+
console.log("error parse data", e2);
|
4762
4768
|
}
|
4763
4769
|
var e = {
|
4764
4770
|
avatar: message.channel_message.avatar,
|
@@ -5081,9 +5087,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5081
5087
|
unfollowUsers(user_ids) {
|
5082
5088
|
return this.send({ status_unfollow: { user_ids } });
|
5083
5089
|
}
|
5084
|
-
updateChatMessage(clan_id, channel_id, mode, message_id, content) {
|
5090
|
+
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions) {
|
5085
5091
|
return __async(this, null, function* () {
|
5086
|
-
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mode } });
|
5092
|
+
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, mode } });
|
5087
5093
|
return response.channel_message_ack;
|
5088
5094
|
});
|
5089
5095
|
}
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -4724,12 +4724,18 @@ var _DefaultSocket = class _DefaultSocket {
|
|
4724
4724
|
} else if (message.channel_message) {
|
4725
4725
|
var content, reactions, mentions, attachments, references;
|
4726
4726
|
try {
|
4727
|
-
|
4728
|
-
|
4729
|
-
|
4730
|
-
|
4731
|
-
|
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);
|
4732
4737
|
} catch (e2) {
|
4738
|
+
console.log("error parse data", e2);
|
4733
4739
|
}
|
4734
4740
|
var e = {
|
4735
4741
|
avatar: message.channel_message.avatar,
|
@@ -5052,9 +5058,9 @@ var _DefaultSocket = class _DefaultSocket {
|
|
5052
5058
|
unfollowUsers(user_ids) {
|
5053
5059
|
return this.send({ status_unfollow: { user_ids } });
|
5054
5060
|
}
|
5055
|
-
updateChatMessage(clan_id, channel_id, mode, message_id, content) {
|
5061
|
+
updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions) {
|
5056
5062
|
return __async(this, null, function* () {
|
5057
|
-
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mode } });
|
5063
|
+
const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, mode } });
|
5058
5064
|
return response.channel_message_ack;
|
5059
5065
|
});
|
5060
5066
|
}
|
package/dist/socket.d.ts
CHANGED
@@ -146,6 +146,8 @@ export interface MessageMentionEvent {
|
|
146
146
|
sender_id: string;
|
147
147
|
user_id: string;
|
148
148
|
username: string;
|
149
|
+
s?: number;
|
150
|
+
e?: number;
|
149
151
|
}
|
150
152
|
/** User is react to message */
|
151
153
|
export interface MessageAttachmentEvent {
|
@@ -266,6 +268,8 @@ interface ChannelMessageUpdate {
|
|
266
268
|
message_id: string;
|
267
269
|
/** The content payload. */
|
268
270
|
content: any;
|
271
|
+
/** mentions */
|
272
|
+
mentions?: Array<MessageMentionEvent>;
|
269
273
|
/** The mode payload. */
|
270
274
|
mode: number;
|
271
275
|
};
|
@@ -460,7 +464,7 @@ export interface Socket {
|
|
460
464
|
/** Unfollow one or more users from their status updates. */
|
461
465
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
462
466
|
/** Update a chat message on a chat channel in the server. */
|
463
|
-
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any): Promise<ChannelMessageAck>;
|
467
|
+
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>): Promise<ChannelMessageAck>;
|
464
468
|
/** Update the status for the current user online. */
|
465
469
|
updateStatus(status?: string): Promise<void>;
|
466
470
|
/** Send a chat message to a chat channel on the server. */
|
@@ -594,7 +598,7 @@ export declare class DefaultSocket implements Socket {
|
|
594
598
|
rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
|
595
599
|
sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void>;
|
596
600
|
unfollowUsers(user_ids: string[]): Promise<void>;
|
597
|
-
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any): Promise<ChannelMessageAck>;
|
601
|
+
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>): Promise<ChannelMessageAck>;
|
598
602
|
updateStatus(status?: string): Promise<void>;
|
599
603
|
writeChatMessage(clan_id: string, channel_id: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, notifi_content?: any): Promise<ChannelMessageAck>;
|
600
604
|
writeMessageReaction(id: string, clan_id: string, channel_id: string, mode: number, message_id: string, emoji_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -197,6 +197,10 @@ export interface MessageMentionEvent {
|
|
197
197
|
user_id: string;
|
198
198
|
// mention username
|
199
199
|
username: string;
|
200
|
+
// start position
|
201
|
+
s?: number;
|
202
|
+
// end position
|
203
|
+
e?: number;
|
200
204
|
}
|
201
205
|
|
202
206
|
/** User is react to message */
|
@@ -375,6 +379,8 @@ interface ChannelMessageUpdate {
|
|
375
379
|
message_id: string,
|
376
380
|
/** The content payload. */
|
377
381
|
content: any,
|
382
|
+
/** mentions */
|
383
|
+
mentions?: Array<MessageMentionEvent>;
|
378
384
|
/** The mode payload. */
|
379
385
|
mode: number;
|
380
386
|
};
|
@@ -650,7 +656,7 @@ export interface Socket {
|
|
650
656
|
unfollowUsers(user_ids : string[]) : Promise<void>;
|
651
657
|
|
652
658
|
/** Update a chat message on a chat channel in the server. */
|
653
|
-
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any) : Promise<ChannelMessageAck>;
|
659
|
+
updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>) : Promise<ChannelMessageAck>;
|
654
660
|
|
655
661
|
/** Update the status for the current user online. */
|
656
662
|
updateStatus(status? : string) : Promise<void>;
|
@@ -866,14 +872,19 @@ export class DefaultSocket implements Socket {
|
|
866
872
|
this.onstreamdata(<StreamData>message.stream_data);
|
867
873
|
} else if (message.channel_message) {
|
868
874
|
var content, reactions, mentions, attachments, references;
|
869
|
-
try {
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
+
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);
|
875
886
|
} catch(e) {
|
876
|
-
|
887
|
+
console.log("error parse data", e);
|
877
888
|
}
|
878
889
|
var e: ChannelMessageEvent = {
|
879
890
|
avatar: message.channel_message.avatar,
|
@@ -1237,8 +1248,8 @@ export class DefaultSocket implements Socket {
|
|
1237
1248
|
return this.send({status_unfollow: {user_ids: user_ids}});
|
1238
1249
|
}
|
1239
1250
|
|
1240
|
-
async updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any): Promise<ChannelMessageAck> {
|
1241
|
-
const response = await this.send({channel_message_update: {clan_id: clan_id, channel_id: channel_id, message_id: message_id, content: content, mode: mode}});
|
1251
|
+
async updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>): Promise<ChannelMessageAck> {
|
1252
|
+
const response = await this.send({channel_message_update: {clan_id: clan_id, channel_id: channel_id, message_id: message_id, content: content, mentions: mentions, mode: mode}});
|
1242
1253
|
return response.channel_message_ack;
|
1243
1254
|
}
|
1244
1255
|
|