This repository was archived by the owner on Aug 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 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
119namespace 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}
You can’t perform that action at this time.
0 commit comments