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

Commit e4f6cf7

Browse files
committed
更新 Redme;
1 parent b7a494a commit e4f6cf7

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

README.md

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,20 @@ cd vcpkg
4848
.\vcpkg integrate install
4949
```
5050

51-
#### (2) 使用 **vcpkg** 安装本项目的依赖库
52-
53-
完成这一步你只需执行:
54-
55-
```powershell
56-
./vcpkg install curl nlohmann-json boost-asio
57-
# 如果你要构建 x64 平台的程序,需要执行:
58-
# ./vcpkg install curl:x64-windows nlohmann-json:x64-windows boost-asio:x64-windows
59-
```
60-
61-
#### (3) 使用 **vcpkg** 安装 **mirai-cpp**
51+
#### (2) 使用 **vcpkg** 安装 **mirai-cpp**
6252

6353
这一步稍微复杂,你需要执行:
6454

6555
```powershell
66-
git clone https://github.com/cyanray/ports.git tmp ; mv tmp/* ports/ ; rm -Recurse -Force tmp
56+
git clone https://github.com/cyanray/mirai-cpp-vcpkg-port.git tmp ; mv tmp/* ports/ ; rm -Recurse -Force tmp
6757
./vcpkg install mirai-cpp
6858
# 如果你要构建 x64 平台的程序,需要执行:
6959
# ./vcpkg install mirai-cpp:x64-windows
7060
```
7161

72-
#### (4) 在 **Visual Studio** 中创建一个项目,开始使用
62+
耐心等待,上面的代码会帮你安装 mirai-cpp 以及它的依赖项目。
63+
64+
#### (3) 在 **Visual Studio** 中创建一个项目,开始使用
7365

7466
尝试以下代码:
7567

@@ -99,26 +91,21 @@ int main()
9991
cout << "成功登录 bot。" << endl;
10092

10193

102-
bot.OnFriendMessageReceived(
94+
bot.On<FriendMessage>(
10395
[&](FriendMessage fm)
10496
{
105-
bot.SendFriendMessage(fm.Sender.QQ, fm.MessageChain);
97+
// bot.SendFriendMessage(fm.Sender.QQ, fm.MessageChain);
98+
fm.Reply(fm.MessageChain);
10699
});
107100

108-
bot.OnGroupMessageReceived(
101+
bot.On<GroupMessage>(
109102
[&](GroupMessage gm)
110103
{
111-
bot.SendGroupMessage(gm.Sender.Group.GID, "为什么要 " + gm.MessageChain);
104+
// bot.SendGroupMessage(gm.Sender.Group.GID, "为什么要 " + gm.MessageChain);
105+
gm.QuoteReply("为什么要 " + gm.MessageChain);
112106
});
113107

114-
try
115-
{
116-
bot.EventLoop();
117-
}
118-
catch (const std::exception & ex)
119-
{
120-
cout << ex.what() << endl;
121-
}
108+
bot.EventLoop();
122109

123110
return 0;
124111
}

0 commit comments

Comments
 (0)