#pragma once #include #include #include #include "message.hpp" namespace bot { namespace irc { class Client { public: Client(std::string username, std::string password); ~Client() = default; void run(); void say(const std::string &channel_login, const std::string &message); bool join(const std::string &channel_login); void raw(const std::string &raw_message); template void on(typename MessageHandler::fn function) { switch (T) { case Privmsg: this->onPrivmsg = function; break; default: break; } } private: void authorize(); std::string username; std::string password; std::string host; std::string port; ix::WebSocket websocket; bool is_connected = false; std::vector pool; std::vector joined_channels; // Message handlers typename MessageHandler::fn onPrivmsg; }; } }