diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-05-21 18:20:56 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-05-21 22:49:45 +0800 |
| commit | 2957f25ce96c4e55f99b8a14e08b9e4a6b5c275d (patch) | |
| tree | e8be9a633cc75ddb0b3cc35cce7697596b784b26 | |
| parent | fb256d473ed33410d11be56244c565884c2f14bb (diff) | |
command(/list): better formatting with session instance ptr
| -rw-r--r-- | src/commands.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index 4166041..b20279d 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1,5 +1,6 @@ #include "commands.hpp" #include "commandHandler.hpp" +#include "format.hpp" #include "sessionManager.hpp" struct SKickArgs { @@ -46,9 +47,10 @@ void registerCommands() { (void)args; return {.data = std::any(), .good = true}; }, .exe = [](const std::any &parsed) -> CCommandHandler::SResult { (void)parsed; - std::string result = "Clients:\n"; + std::string result = "ID \t Name \t IP \t Muted\n"; for (const auto &session : g_pSessionManager->getSessions()) - result += session->getName() + "\t" + session->getIp() + "\t" + (session->isMuted() ? "[MUTED]" : "[UNMUTED]") + "\n"; + result += NFormatter::fmt(NONEWLINE, "{} \t {} \t {} \t {}\n", (uintptr_t)session.get(), session->getName(), session->getIp(), (session->isMuted() ? "[MUTED]" : "[UNMUTED]")); + return {.result = result, .good = true}; }}); |
