#include "command.hpp" #include #include #include #include "../bundle.hpp" #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 InstanceBundle &bundle, const irc::Message &msg) const { for (const std::unique_ptr &command : this->commands) { if (command->get_name() == msg.message) { return command->run(bundle, msg); } } return std::nullopt; } } }