tjc-sdk
Version:
TIANJI IM SDK
2 lines (1 loc) • 971 B
JavaScript
import t from"../../client/tjc.js";import{MessageContentType as i}from"../messageContentType.js";import s from"./groupNotification.js";class e extends s{invitor="";invitees=[];constructor(t,s){super(i.AddGroupMember_Notification),this.invitor=t,this.invitees=s}formatNotification(){let i;if(1===this.invitees.length&&this.invitees[0]===this.invitor)return this.fromSelf?"您加入了群组":t.getGroupMemberDisplayName(this.groupId,this.invitor)+" 加入了群组";i=this.fromSelf?"您邀请:":t.getGroupMemberDisplayName(this.groupId,this.invitor)+"邀请:";let s="";return t.getUserInfos(this.invitees,this.groupId).forEach((t=>{s+=" "+t.displayName})),i+s+"加入了群组"}encode(){let i=super.encode(),s={g:this.groupId,o:this.invitor,ms:this.invitees};return i.binaryContent=t.utf8_to_b64(JSON.stringify(s)),i}decode(i){super.decode(i);let s=t.b64_to_utf8(i.binaryContent),e=JSON.parse(s);this.groupId=e.g,this.invitor=e.o,this.invitees=e.ms}}export{e as default};