#include "command.hpp" #include #include #include #include "../modules/ping.hpp" namespace bot { namespace command { CommandLoader::CommandLoader() { this->add_command(std::make_unique()); } void CommandLoader::add_command(std::unique_ptr command) { this->commands.push_back(std::move(command)); } std::optional, std::string>> CommandLoader::run(const irc::Message &msg) { for (const std::unique_ptr &command : this->commands) { if (command->get_name() == msg.message) { return command->run(msg); } } return std::nullopt; } } }