tjc-sdk
Version:
TIANJI IM SDK
2 lines (1 loc) • 782 B
JavaScript
import t from"./groupNotification.js";import{MessageContentType as s}from"../messageContentType.js";import e from"../../client/tjc.js";class i extends t{operator;privateChatType;constructor(t,e){super(s.ChangePrivateChat_Notification),this.operator=t,this.privateChatType=e}formatNotification(t){let s=this.fromSelf?"您":e.getGroupMemberDisplayName(this.groupId,this.operator);return s+=0===this.privateChatType?" 开启了成员私聊":" 关闭了成员私聊",s}encode(){let t=super.encode(),s={g:this.groupId,o:this.operator,n:this.privateChatType+""};return t.binaryContent=e.utf8_to_b64(JSON.stringify(s)),t}decode(t){super.decode(t);let s=JSON.parse(e.b64_to_utf8(t.binaryContent));this.groupId=s.g,this.operator=s.o,this.privateChatType=parseInt(s.n)}}export{i as default};