#include "message.hpp" #include #include #include namespace bot { namespace irc { std::optional define_message_type(const std::string &msg) { std::vector parts = utils::string::split_text(msg, ' '); int i; if (msg[0] == '@') { i = 2; } else if (msg[0] == ':') { i = 1; } else { return std::nullopt; } if (parts[i] == "NOTICE") { return MessageType::Notice; } else if (parts[i] == "PRIVMSG") { return MessageType::Privmsg; } return std::nullopt; } } }