-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from cyanray/dev/cyanray
适配 mah v2.5.0 其他客户端同步消息;
- Loading branch information
Showing
7 changed files
with
284 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#pragma once | ||
#ifndef mirai_cpp_events_FriendSyncMessage_hpp_H_ | ||
#define mirai_cpp_events_FriendSyncMessage_hpp_H_ | ||
|
||
#include "mirai/third-party/nlohmann/json.hpp" | ||
#include "mirai/defs/QQType.hpp" | ||
#include "mirai/defs/MessageChain.hpp" | ||
#include "mirai/defs/Friend.hpp" | ||
#include "EventBase.hpp" | ||
|
||
namespace Cyan | ||
{ | ||
/** | ||
* \brief Bot在其他客户端发送给好友的消息 | ||
*/ | ||
class FriendSyncMessage : public EventBase | ||
{ | ||
public: | ||
Cyan::MessageChain MessageChain; | ||
Friend_t Subject; | ||
|
||
static MiraiEvent GetMiraiEvent() | ||
{ | ||
return MiraiEvent::FriendSyncMessage; | ||
} | ||
|
||
MessageId_t MessageId() const | ||
{ | ||
return (this->MessageChain).MessageId(); | ||
} | ||
|
||
int64_t Timestamp() const | ||
{ | ||
return (this->MessageChain).Timestamp(); | ||
} | ||
|
||
virtual bool Set(const json& j) override | ||
{ | ||
this->MessageChain.Set(j["messageChain"]); | ||
Subject.Set(j["subject"]); | ||
return true; | ||
} | ||
virtual json ToJson() const override | ||
{ | ||
json j = json::object(); | ||
j["messageChain"] = this->MessageChain.ToJson(); | ||
j["subject"] = this->Subject.ToJson(); | ||
return j; | ||
} | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#pragma once | ||
#ifndef mirai_cpp_events_GroupSyncMessage_hpp_H_ | ||
#define mirai_cpp_events_GroupSyncMessage_hpp_H_ | ||
|
||
#include "mirai/third-party/nlohmann/json.hpp" | ||
#include "mirai/defs/QQType.hpp" | ||
#include "mirai/defs/MessageChain.hpp" | ||
#include "mirai/defs/Group.hpp" | ||
#include "EventBase.hpp" | ||
|
||
namespace Cyan | ||
{ | ||
/** | ||
* \brief Bot在其他客户端发送给群组的消息 | ||
*/ | ||
class GroupSyncMessage : public EventBase | ||
{ | ||
public: | ||
Cyan::MessageChain MessageChain; | ||
Group_t Subject; | ||
|
||
static MiraiEvent GetMiraiEvent() | ||
{ | ||
return MiraiEvent::GroupSyncMessage; | ||
} | ||
|
||
MessageId_t MessageId() const | ||
{ | ||
return (this->MessageChain).MessageId(); | ||
} | ||
|
||
int64_t Timestamp() const | ||
{ | ||
return (this->MessageChain).Timestamp(); | ||
} | ||
|
||
virtual bool Set(const json& j) override | ||
{ | ||
this->MessageChain.Set(j["messageChain"]); | ||
Subject.Set(j["subject"]); | ||
return true; | ||
} | ||
virtual json ToJson() const override | ||
{ | ||
json j = json::object(); | ||
j["messageChain"] = this->MessageChain.ToJson(); | ||
j["subject"] = this->Subject.ToJson(); | ||
return j; | ||
} | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#pragma once | ||
#ifndef mirai_cpp_events_StrangerSyncMessage_hpp_H_ | ||
#define mirai_cpp_events_StrangerSyncMessage_hpp_H_ | ||
|
||
#include "mirai/third-party/nlohmann/json.hpp" | ||
#include "mirai/defs/QQType.hpp" | ||
#include "mirai/defs/MessageChain.hpp" | ||
#include "mirai/defs/Friend.hpp" | ||
#include "EventBase.hpp" | ||
|
||
namespace Cyan | ||
{ | ||
/** | ||
* \brief Bot在其他客户端发送给好友的消息 | ||
*/ | ||
class StrangerSyncMessage : public EventBase | ||
{ | ||
public: | ||
Cyan::MessageChain MessageChain; | ||
Friend_t Subject; | ||
|
||
static MiraiEvent GetMiraiEvent() | ||
{ | ||
return MiraiEvent::StrangerSyncMessage; | ||
} | ||
|
||
MessageId_t MessageId() const | ||
{ | ||
return (this->MessageChain).MessageId(); | ||
} | ||
|
||
int64_t Timestamp() const | ||
{ | ||
return (this->MessageChain).Timestamp(); | ||
} | ||
|
||
virtual bool Set(const json& j) override | ||
{ | ||
this->MessageChain.Set(j["messageChain"]); | ||
Subject.Set(j["subject"]); | ||
return true; | ||
} | ||
virtual json ToJson() const override | ||
{ | ||
json j = json::object(); | ||
j["messageChain"] = this->MessageChain.ToJson(); | ||
j["subject"] = this->Subject.ToJson(); | ||
return j; | ||
} | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#pragma once | ||
#ifndef mirai_cpp_events_TempSyncMessage_hpp_H_ | ||
#define mirai_cpp_events_TempSyncMessage_hpp_H_ | ||
|
||
#include "mirai/third-party/nlohmann/json.hpp" | ||
#include "mirai/defs/QQType.hpp" | ||
#include "mirai/defs/MessageChain.hpp" | ||
#include "mirai/defs/GroupMember.hpp" | ||
#include "EventBase.hpp" | ||
|
||
namespace Cyan | ||
{ | ||
/** | ||
* \brief Bot在其他客户端发送给群组的消息 | ||
*/ | ||
class TempSyncMessage : public EventBase | ||
{ | ||
public: | ||
Cyan::MessageChain MessageChain; | ||
GroupMember Subject; | ||
|
||
static MiraiEvent GetMiraiEvent() | ||
{ | ||
return MiraiEvent::TempSyncMessage; | ||
} | ||
|
||
MessageId_t MessageId() const | ||
{ | ||
return (this->MessageChain).MessageId(); | ||
} | ||
|
||
int64_t Timestamp() const | ||
{ | ||
return (this->MessageChain).Timestamp(); | ||
} | ||
|
||
virtual bool Set(const json& j) override | ||
{ | ||
this->MessageChain.Set(j["messageChain"]); | ||
Subject.Set(j["subject"]); | ||
return true; | ||
} | ||
virtual json ToJson() const override | ||
{ | ||
json j = json::object(); | ||
j["messageChain"] = this->MessageChain.ToJson(); | ||
j["subject"] = this->Subject.ToJson(); | ||
return j; | ||
} | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters