Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions include/mirai_bot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ using nlohmann::json;
#ifdef CreateEvent
#undef CreateEvent
#endif
#ifdef SetPort
#undef SetPort
#endif

namespace Cyan
{
Expand All @@ -44,8 +47,22 @@ namespace Cyan
* \param port port
*/
MiraiBot(const string& host, int port);
MiraiBot(const MiraiBot&) = delete;
MiraiBot& operator=(const MiraiBot&) = delete;
~MiraiBot();

/**
* \brief 设置 Host
* \param host Host
* \return MiraiBot 引用
*/
MiraiBot& SetHost(const string& host);
/**
* \brief 设置 Port
* \param port Port
* \return MiraiBot 引用
*/
MiraiBot& SetPort(int port);
/**
* \brief 获得 mirai-cpp 适配的 API 版本
* \return 用数字表示的版本号 (10605)
Expand Down
13 changes: 13 additions & 0 deletions src/mirai_bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ namespace Cyan
{
Release();
}

MiraiBot& MiraiBot::SetHost(const string& host)
{
this->host_ = host;
return *this;
}

MiraiBot& MiraiBot::SetPort(int port)
{
this->port_ = port;
return *this;
}

string MiraiBot::GetSessionKey() const
{
return sessionKey_;
Expand Down