#pragma once #include #include #include #include #include enum class CommandCategory { Music, Session, Utility }; inline std::string to_string(CommandCategory category) { switch (category) { case CommandCategory::Music: return "Music"; case CommandCategory::Session: return "Session"; case CommandCategory::Utility: return "Utility"; } return "Utility"; } /** * @brief Context passed to every command execution. * Wraps all dependencies required to perform an action. */ struct CommandContext { std::uint64_t serverConnectionHandlerID; anyID clientID; std::string args; // Arguments excluding the command name std::string_view invokerName; // Dependencies std::shared_ptr ts3; std::weak_ptr musicManager; // Non-owning reference // Helper to reply to the user void reply(std::string_view message) const; }; /** * @brief Interface that all commands must implement. */ class Command { public: virtual ~Command() = default; /** * @brief The logic of the command. */ virtual void execute(const CommandContext& ctx) = 0; /** * @brief Returns the description used for .help generation. */ virtual std::string_view getDescription() const = 0; /** * @brief Returns usage syntax (e.g., ""). */ virtual std::string_view getUsage() const = 0; virtual CommandCategory getCategory() const { return CommandCategory::Utility; } // Commands can now define their own aliases for the help menu virtual std::vector getAliases() const { return {}; } };