From ee676a08ea40a6da0033b54e798f0c25587f9d44 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 9 Jan 2023 01:59:18 -0500 Subject: [PATCH] Better logging and error reporting. --- src/discord/handlers/DevRequestHandler.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/discord/handlers/DevRequestHandler.java b/src/discord/handlers/DevRequestHandler.java index 41677cd7..f0eb5398 100644 --- a/src/discord/handlers/DevRequestHandler.java +++ b/src/discord/handlers/DevRequestHandler.java @@ -56,17 +56,20 @@ public class DevRequestHandler { break; } - if (commandString.isEmpty() == false) { + if (commandString.isEmpty()) { + MagicBot.sendResponse(event, "Unrecognized Dev command: " + serverCommand + " " + commandArgument); + return; + } + + processBuilder = new ProcessBuilder("/bin/sh", "-c", commandString + " " + commandArgument); - processBuilder = new ProcessBuilder("/bin/sh", "-c", commandString + " " + commandArgument); - try { + try { processBuilder.start(); } catch (IOException e) { - throw new RuntimeException(e); + Logger.info(e.toString()); } MagicBot.sendResponse(event, "Executed on dev: " + serverCommand + " " + commandArgument); Logger.info(event.getAuthor().getName() + " told dev to " + serverCommand + " " + commandArgument); } - } } \ No newline at end of file