diff --git a/Dice/BlackListManager.cpp b/Dice/BlackListManager.cpp index db138b59..f6280633 100644 --- a/Dice/BlackListManager.cpp +++ b/Dice/BlackListManager.cpp @@ -46,22 +46,27 @@ void checkGroupWithBlackQQ(const DDBlackMark& mark, long long llQQ) string strNotice; for (auto& [id, grp] : ChatList) { - if (grp.isset("已退") || grp.isset("忽略") || !grp.isGroup)continue; - if (getGroupMemberInfo(id, llQQ).QQID == llQQ) + if (grp.isset("已退") || grp.isset("未进") || grp.isset("忽略") || grp.isset("协议无效") || !grp.isGroup)continue; + if (GroupMemberInfo member = getGroupMemberInfo(id, llQQ); member.QQID == llQQ) { strNotice = printGroup(id); - if (grp.isset("免黑")) + if (grp.isset("协议无效")) { + strNotice += "群协议无效"; + } + else if (grp.isset("免黑")) { if (mark.isSource(console.DiceMaid) && !mark.isType("local"))sendGroupMsg(id, mark.warning()); strNotice += "群免黑"; } - else if (getGroupMemberInfo(id, llQQ).permissions < getGroupMemberInfo(id, getLoginQQ()).permissions) - { + else if (GroupMemberInfo self = getGroupMemberInfo(id, console.DiceMaid); !self.permissions) { + continue; + } + else if (member.permissions < self.permissions) { if (mark.isSource(console.DiceMaid && !mark.isType("local")))AddMsgToQueue( mark.warning(), id, msgtype::Group); strNotice += "对方群权限较低"; } - else if (getGroupMemberInfo(id, llQQ).permissions > getGroupMemberInfo(id, getLoginQQ()).permissions) + else if (member.permissions > self.permissions) { sendGroupMsg(id, mark.warning()); grp.leave("发现新增黑名单管理员" + printQQ(llQQ) + "\n" + GlobalMsg["strSelfName"] + "将预防性退群"); diff --git a/Dice/Dice.cpp b/Dice/Dice.cpp index d71848ec..5c1944bd 100644 --- a/Dice/Dice.cpp +++ b/Dice/Dice.cpp @@ -474,7 +474,13 @@ bool eve_GroupAdd(Chat& grp) if (ChatList.size() == 1 && !console.isMasterMode)sendGroupMsg(grp.ID, msgInit); } GroupInfo ginf(grp.ID); - grp.Name = ginf.strGroupName; + //群信息是否获取成功 + if (ginf.llGroup) { + grp.Name = ginf.strGroupName; + } + else { + ginf.llGroup = grp.ID; + } if (grp.boolConf.empty() && ginf.nGroupSize > 499) { grp.set("协议无效"); } diff --git a/Dice/DiceEvent.cpp b/Dice/DiceEvent.cpp index 0d190b6b..50654112 100644 --- a/Dice/DiceEvent.cpp +++ b/Dice/DiceEvent.cpp @@ -754,7 +754,7 @@ int FromMsg::DiceReply() strVar["nick"] = getName(fromQQ, fromGroup); getPCName(*this); strVar["at"] = intT ? "[CQ:at,qq=" + to_string(fromQQ) + "]" : strVar["nick"]; - isAuth = trusted > 3 || intT != GroupT || getGroupMemberInfo(fromGroup, fromQQ).permissions > 1 || pGrp->inviter == fromQQ; + isAuth = trusted > 3 || intT != GroupT || getGroupMemberInfo(fromGroup, fromQQ).permissions != 1 || pGrp->inviter == fromQQ; //指令匹配 if (strLowerMessage.substr(intMsgCnt, 9) == "authorize") { diff --git a/Dice/ManagerSystem.cpp b/Dice/ManagerSystem.cpp index c47dbaf5..4b8d5748 100644 --- a/Dice/ManagerSystem.cpp +++ b/Dice/ManagerSystem.cpp @@ -144,6 +144,10 @@ Chat& Chat::id(long long grp) { return *this; } +bool Chat::is_except()const { + return boolConf.count("免黑") || boolConf.count("协议无效"); +} + int groupset(long long id, string st) { if (!ChatList.count(id))return -1; diff --git a/Dice/ManagerSystem.h b/Dice/ManagerSystem.h index e912f1b0..9c9c9f8f 100644 --- a/Dice/ManagerSystem.h +++ b/Dice/ManagerSystem.h @@ -251,8 +251,7 @@ class Chat else CQ::sendDiscussMsg(ID, msg); Sleep(500); } - if (isGroup)CQ::setGroupLeave(ID); - else CQ::setDiscussLeave(ID); + isGroup ? CQ::setGroupLeave(ID) : CQ::setDiscussLeave(ID); set("已退"); } @@ -261,6 +260,8 @@ class Chat return boolConf.count(key) || intConf.count(key) || strConf.count(key); } + bool is_except()const; + void setConf(const string& key, int val) { intConf[key] = val;