From 59b52bfab39d98a11052497ab387011a9835ef1b Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 19 May 2024 02:10:39 +0500 Subject: feat: handle ping messages --- bot/src/irc/client.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bot/src/irc/client.cpp') diff --git a/bot/src/irc/client.cpp b/bot/src/irc/client.cpp index 018736e..06b7a03 100644 --- a/bot/src/irc/client.cpp +++ b/bot/src/irc/client.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,12 @@ void Client::run() { if (message.has_value()) { this->onPrivmsg(message.value()); } + } else if (m_type == MessageType::Ping) { + // as the docs say, the message should be the same as the one + // from the ping + std::string response_text = msg->str.substr(4, msg->str.size()); + + this->raw("PONG" + response_text); } } -- cgit v1.2.3