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

Commit 048da54

Browse files
committed
WebSocet失去与mirai的连接后自动重连;
1 parent fd0bd18 commit 048da54

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/mirai_bot.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@ namespace Cyan
756756
{
757757
Release();
758758
Auth(authKey_, qq_);
759+
throw std::runtime_error("失去与mirai的连接,尝试重新验证...");
759760
}
760761
string msg = reJson["msg"].get<string>();
761762
throw runtime_error(msg);
@@ -795,6 +796,13 @@ namespace Cyan
795796
if (!eventJsonStr.empty())
796797
{
797798
json j = json::parse(eventJsonStr);
799+
if (j.find("code") != j.end() && j["code"].get<int>() == 3)
800+
{
801+
Release();
802+
Auth(authKey_, qq_);
803+
SessionConfigure(cacheSize_, ws_enabled_);
804+
throw std::runtime_error("失去与mirai的连接,尝试重新验证...");
805+
}
798806
ProcessEvents(j);
799807
eventJsonStr.resize(0);
800808
}

0 commit comments

Comments
 (0)