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

Commit 01f73f4

Browse files
committed
修复编译错误;
1 parent fd83d1b commit 01f73f4

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/event_func.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#include <exception>
2+
#include <algorithm>
13
#include "mirai_bot.hpp"
24
#include "events/events.hpp"
35
#include "httplib.h"
4-
#include <algorithm>
56

67
namespace Cyan
78
{
@@ -70,7 +71,7 @@ namespace Cyan
7071
return true;
7172
}
7273
else
73-
throw runtime_error("网络错误");
74+
throw std::runtime_error("网络错误");
7475

7576
}
7677

@@ -96,7 +97,7 @@ namespace Cyan
9697
return true;
9798
}
9899
else
99-
throw runtime_error("网络错误");
100+
throw std::runtime_error("网络错误");
100101

101102
}
102103

src/mirai_bot.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,35 @@ using std::stringstream;
1010

1111
namespace Cyan
1212
{
13-
inline MiraiBot::MiraiBot() :
13+
MiraiBot::MiraiBot() :
1414
qq_(0),
1515
pool_(4),
1616
http_client_("localhost", 8080),
1717
host_("localhost"),
1818
port_(8080),
1919
cacheSize_(4096),
2020
ws_enabled_(true) {}
21-
inline MiraiBot::MiraiBot(const string& host, int port) :
21+
MiraiBot::MiraiBot(const string& host, int port) :
2222
qq_(0),
2323
pool_(4),
2424
http_client_(host, port),
2525
host_(host),
2626
port_(port),
2727
cacheSize_(4096),
2828
ws_enabled_(true) {}
29-
inline MiraiBot::~MiraiBot()
29+
MiraiBot::~MiraiBot()
3030
{
3131
Release();
3232
}
33-
inline string MiraiBot::GetSessionKey() const
33+
string MiraiBot::GetSessionKey() const
3434
{
3535
return sessionKey_;
3636
}
37-
inline QQ_t MiraiBot::GetBotQQ() const
37+
QQ_t MiraiBot::GetBotQQ() const
3838
{
3939
return qq_;
4040
}
41-
inline httplib::Client* MiraiBot::GetHttpClient()
41+
httplib::Client* MiraiBot::GetHttpClient()
4242
{
4343
return &(this->http_client_);
4444
}
@@ -590,14 +590,14 @@ namespace Cyan
590590
return *this;
591591
}
592592

593-
inline MiraiBot& MiraiBot::UseWebSocket()
593+
MiraiBot& MiraiBot::UseWebSocket()
594594
{
595595
this->ws_enabled_ = true;
596596
SessionConfigure(cacheSize_, ws_enabled_);
597597
return *this;
598598
}
599599

600-
inline MiraiBot& MiraiBot::UseHTTP()
600+
MiraiBot& MiraiBot::UseHTTP()
601601
{
602602
this->ws_enabled_ = false;
603603
SessionConfigure(cacheSize_, ws_enabled_);
@@ -785,7 +785,7 @@ namespace Cyan
785785
string eventJsonStr;
786786
while (ws->getReadyState() != WebSocket::CLOSED && this->ws_enabled_)
787787
{
788-
788+
789789
ws->poll(20);
790790
ws->dispatch([&](const std::string& message)
791791
{
@@ -879,7 +879,7 @@ namespace Cyan
879879
}
880880
}
881881

882-
inline bool MiraiBot::Release() noexcept
882+
bool MiraiBot::Release() noexcept
883883
{
884884
try
885885
{
@@ -893,7 +893,7 @@ namespace Cyan
893893
}
894894

895895
// 因为 httplib 使用 string 来保存文件内容,这里返回值也跟着适配
896-
inline string MiraiBot::ReadFile(const string& filename)
896+
string MiraiBot::ReadFile(const string& filename)
897897
{
898898
std::ifstream ifs(filename, std::ifstream::binary);
899899
std::filebuf* pbuf = ifs.rdbuf();

0 commit comments

Comments
 (0)