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

Commit fd0bd18

Browse files
committed
更新 examples;
1 parent ab4517c commit fd0bd18

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

examples/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ api_exe(MemberJoinEvent)
2424
api_exe(BotEvents)
2525
api_exe(MemberLeaveEvent)
2626
api_exe(RecallEvent)
27-
api_exe(MessageType)
27+
api_exe(MessageType)
28+
api_exe(FetchEventsViaHTTP)
29+
api_exe(CompareMessage)

examples/CompareMessage.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <iostream>
2+
// 使用静态库必须要在引入 mirai.h 前定义这个宏
3+
#define MIRAICPP_STATICLIB
4+
#include <mirai.h>
5+
6+
int main()
7+
{
8+
using namespace std;
9+
using namespace Cyan;
10+
system("chcp 65001");
11+
12+
MessageChain mc1 = MessageChain().Plain("##").At(123456_qq).Face(14).Plain("Hello");
13+
MessageChain mc2 = MessageChain().Plain("##").At(1234569_qq).Face(14).Plain("Hello");
14+
15+
if (mc1 == mc2)
16+
cout << "mc1 == mc2" << endl;
17+
else
18+
cout << "mc1 != mc2" << endl;
19+
20+
if (mc1 != mc2)
21+
cout << "mc1 != mc2" << endl;
22+
else
23+
cout << "mc1 == mc2" << endl;
24+
25+
return 0;
26+
}
File renamed without changes.

include/defs/message_chain.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ namespace Cyan
105105
}
106106
return true;
107107
}
108+
bool operator!=(const MessageChain& mc) const
109+
{
110+
return !this->operator==(mc);
111+
}
108112
virtual ~MessageChain() = default;
109113
MessageChain& At(const QQ_t qq)
110114
{

0 commit comments

Comments
 (0)