tjc-sdk
Version:
TIANJI IM SDK
2 lines (1 loc) • 837 B
JavaScript
import t from"./groupNotification.js";import s from"../../client/tjc.js";import{MessageContentType as e}from"../messageContentType.js";class i extends t{operator;joinType;constructor(t,s){super(e.ChangeJoinType_Notification),this.operator=t,this.type=s}formatNotification(t){let e;switch(e=this.fromSelf?"您":s.getGroupMemberDisplayName(this.groupId,this.operator),this.joinType){case 0:e+=" 开放了加入群组功能";break;case 1:e+=" 仅允许群成员邀请加入群组";break;case 2:e+=" 关闭了加入群组功能"}return e}encode(){let t=super.encode(),e={g:this.groupId,o:this.operator,n:this.joinType+""};return t.binaryContent=s.utf8_to_b64(JSON.stringify(e)),t}decode(t){super.decode(t);let e=JSON.parse(s.b64_to_utf8(t.binaryContent));this.groupId=e.g,this.operator=e.o,this.joinType=parseInt(e.n)}}export{i as default};