From 554a0a88b805dbee8361908538e072302c3ebfa8 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 21 May 2025 19:32:26 +0800 Subject: feat: non-admin commands --- src/commandHandler.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/commandHandler.hpp') 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 #include #include @@ -23,6 +24,7 @@ class CCommandHandler { }; struct SCommand { + bool requireAdmin = true; std::string name; std::function parser; std::function 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 struct SMakeCommandArgs { -- cgit v1.2.3