This repository was archived by the owner on Aug 16, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 66#include " mirai/third-party/nlohmann/json.hpp"
77#include " event_interface.hpp"
88#include " mirai/defs/group.hpp"
9+ #include " mirai/defs/group_member.hpp"
910std::optional;
1011
1112namespace Cyan
Original file line number Diff line number Diff line change 22#ifndef mirai_cpp_events_BotLeaveEventKick_hpp_H_
33#define mirai_cpp_events_BotLeaveEventKick_hpp_H_
44
5+ #include < optional>
56#include " mirai/third-party/nlohmann/json.hpp"
67#include " mirai/defs/group.hpp"
8+ #include " mirai/defs/group_member.hpp"
79#include " event_interface.hpp"
10+ using std::optional;
811
912namespace Cyan
1013{
@@ -16,6 +19,7 @@ namespace Cyan
1619 {
1720 public:
1821 Group_t Group;
22+ std::optional<GroupMember> Inviter;
1923
2024 static MiraiEvent GetMiraiEvent ()
2125 {
@@ -25,13 +29,21 @@ namespace Cyan
2529 virtual bool Set (const json& j) override
2630 {
2731 this ->Group .Set (j[" group" ]);
32+ if (!j[" invitor" ].is_null ())
33+ {
34+ GroupMember tmp;
35+ tmp.Set (j[" invitor" ]);
36+ this ->Inviter = tmp;
37+ }
2838 return true ;
2939 }
3040 virtual json ToJson () const override
3141 {
3242 json j = json::object ();
3343 j[" type" ] = " BotLeaveEventKick" ;
3444 j[" group" ] = this ->Group .ToJson ();
45+ // Not a typo, MAH made a typo.
46+ j[" invitor" ] = (Inviter ? this ->Inviter ->ToJson () : json (nullptr ));
3547 return j;
3648 }
3749
You can’t perform that action at this time.
0 commit comments