1+ #pragma once
2+ #ifndef mirai_cpp_defs_Announcement_hpp_H_
3+ #define mirai_cpp_defs_Announcement_hpp_H_
4+
5+ #include " mirai/third-party/nlohmann/json.hpp"
6+ #include " mirai/defs/QQType.hpp"
7+ #include " mirai/defs/Group.hpp"
8+ #include " ISerializable.hpp"
9+
10+ namespace Cyan
11+ {
12+ /* *
13+ * @brief 群通告
14+ */
15+ class GroupAnnouncement : public ISerializable
16+ {
17+ public:
18+ /* *
19+ * @brief 群组
20+ */
21+ Group_t Group;
22+
23+ /* *
24+ * @brief 群公告内容
25+ */
26+ string Content;
27+
28+ /* *
29+ * @brief 发送者 QQ
30+ */
31+ QQ_t SenderQQ;
32+
33+ /* *
34+ * @brief 群公告唯一Id
35+ */
36+ string AnnouncementId;
37+
38+ /* *
39+ * @brief 是否所有群成员已确认
40+ */
41+ bool AllConfirmed;
42+
43+ /* *
44+ * @brief 已经确认的人数
45+ */
46+ int ConfirmedMembersCount;
47+
48+ /* *
49+ * @brief 发布时间
50+ */
51+ int64_t PublicationTime;
52+
53+ virtual bool Set (const json& j) override
54+ {
55+ Group.Set (j[" group" ]);
56+ Content = j[" content" ].get <string>();
57+ SenderQQ = (QQ_t)j[" senderId" ].get <int64_t >();
58+ AnnouncementId = j[" fid" ].get <string>();
59+ AllConfirmed = j[" allConfirmed" ].get <bool >();
60+ ConfirmedMembersCount = j[" confirmedMembersCount" ].get <int >();
61+ PublicationTime = j[" publicationTime" ].get <int64_t >();
62+ return true ;
63+ }
64+ virtual json ToJson () const override
65+ {
66+ return
67+ {
68+ { " group" , Group.ToJson () },
69+ { " content" , Content },
70+ { " senderId" , SenderQQ.ToInt64 () },
71+ { " fid" , AnnouncementId },
72+ { " allConfirmed" , AllConfirmed },
73+ { " confirmedMembersCount" , ConfirmedMembersCount },
74+ { " publicationTime" , PublicationTime }
75+ };
76+ }
77+ };
78+
79+ }
80+
81+ #endif
0 commit comments