diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-05-21 19:32:26 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-05-21 22:49:45 +0800 |
| commit | 554a0a88b805dbee8361908538e072302c3ebfa8 (patch) | |
| tree | 127a0cfb2cb99daba5cd40451479f77b3a5a4937 /src/commandHandler.hpp | |
| parent | 2957f25ce96c4e55f99b8a14e08b9e4a6b5c275d (diff) | |
feat: non-admin commands
Diffstat (limited to 'src/commandHandler.hpp')
| -rw-r--r-- | src/commandHandler.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/commandHandler.hpp b/src/commandHandler.hpp index a69011e..f446574 100644 --- a/src/commandHandler.hpp +++ b/src/commandHandler.hpp @@ -1,5 +1,6 @@ #pragma once +#include "session.hpp" #include <any> #include <functional> #include <memory> @@ -23,6 +24,7 @@ class CCommandHandler { }; struct SCommand { + bool requireAdmin = true; std::string name; std::function<SParseResult(const std::string &args)> parser; std::function<SResult(const std::any &parsed)> exe; @@ -32,8 +34,8 @@ class CCommandHandler { bool validCommand(const std::string &command) const; // return false if command struct is invalid bool registerCommand(const SCommand &command); - SResult newCommand(const std::string &command, const std::string &args) const; - void handleCommand(std::string input, const std::string &ip = {}) const; + SResult newCommand(const std::string &command, const std::string &args, CSession* const user) const; + void handleCommand(std::string input, CSession* const user = nullptr) const; template <typename T> struct SMakeCommandArgs { |
