From b4fca15aec26332c1315c8c3030169bbf342da3e Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 21 Apr 2024 03:25:12 +0500 Subject: feat: command loader --- src/commands/command.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/commands/command.hpp') diff --git a/src/commands/command.hpp b/src/commands/command.hpp index 6e05779..6efe505 100644 --- a/src/commands/command.hpp +++ b/src/commands/command.hpp @@ -1,3 +1,7 @@ +#pragma once + +#include +#include #include #include #include @@ -7,9 +11,23 @@ namespace bot { namespace command { class Command { + public: virtual std::string get_name() = 0; virtual std::variant, std::string> run( const irc::Message &msg) = 0; }; + + class CommandLoader { + public: + CommandLoader(); + ~CommandLoader() = default; + + void add_command(std::unique_ptr cmd); + std::optional, std::string>> run( + const irc::Message &msg); + + private: + std::vector> commands; + }; } } -- cgit v1.2.3