Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit a359887

Browse files
committed
完善群成员被踢出群事件;
1 parent 054195c commit a359887

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

include/events/member_leave_kick.hpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
#define mirai_cpp_events_member_leave_kick_event_hpp_H_
44

55
#include <nlohmann/json.hpp>
6-
#include "defs/qq_types.hpp"
7-
#include "defs/serializable.hpp"
8-
#include "defs/group_member.hpp"
96
#include "event_interface.hpp"
7+
#include "defs/group_member.hpp"
108

119
namespace Cyan
1210
{
@@ -22,21 +20,34 @@ namespace Cyan
2220
return MiraiEvent::MemberLeaveEventKick;
2321
}
2422

23+
bool OperatorIsBot() const
24+
{
25+
return operator_is_null_;
26+
}
27+
2528
virtual bool Set(const json& j) override
2629
{
2730
this->Member.Set(j["member"]);
28-
this->Operator.Set(j["operator"]);
31+
if (!j["operator"].is_null())
32+
{
33+
this->Operator.Set(j["operator"]);
34+
this->operator_is_null_ = false;
35+
}
2936
return true;
3037
}
3138
virtual json ToJson() const override
3239
{
3340
json j = json::object();
3441
j["type"] = "MemberLeaveEventKick";
3542
j["member"] = this->Member.ToJson();
36-
j["operator"] = this->Operator.ToJson();
43+
if (!operator_is_null_)
44+
j["operator"] = this->Operator.ToJson();
45+
else
46+
j["operator"] = nullptr;
3747
return j;
3848
}
39-
49+
private:
50+
bool operator_is_null_ = true;
4051
};
4152

4253
}

0 commit comments

Comments
 (0)