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

Commit 06c2cf2

Browse files
committed
BotLeaveEventKick 事件可获取操作的管理员信息; 修复编译错误;
1 parent 927275d commit 06c2cf2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/mirai/events/BotJoinGroupEvent.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
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"
910
std::optional;
1011

1112
namespace Cyan

include/mirai/events/BotLeaveEventKick.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
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

912
namespace 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

0 commit comments

Comments
 (0)