From 064afddda92e314e62dbbeabfe8013e345539e00 Mon Sep 17 00:00:00 2001 From: "Weston Rye (Demod)" Date: Thu, 29 Jun 2017 00:01:12 -0400 Subject: [PATCH] Resolved #7 --- .../demod/fbsr/app/BlueprintBotDiscordService.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotDiscordService.java b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotDiscordService.java index 2c828e8..70f0ebd 100644 --- a/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotDiscordService.java +++ b/FactorioBlueprintStringRenderer/src/com/demod/fbsr/app/BlueprintBotDiscordService.java @@ -72,23 +72,25 @@ public class BlueprintBotDiscordService extends AbstractIdleService { private String reportingChannelID; - private CommandHandler createDataRawCommandHandler(Function> query) { + private CommandHandler createDataRawCommandHandler(Function> query) { return event -> { - String content = event.getMessage().getStrippedContent(); + String content = event.getMessage().getContent(); TaskReporting reporting = new TaskReporting(); reporting.setContext(content); try { String[] args = content.split("\\s"); if (args.length < 2) { - event.getChannel().sendMessage("You didn't specify a key!").complete(); + event.getChannel().sendMessage("You didn't specify a path!").complete(); return; } - String key = content.substring(args[0].length()).trim(); - Optional lua = query.apply(key); + String[] path = key.split("."); + Optional lua = query.apply(path); if (!lua.isPresent()) { - event.getChannel().sendMessage("I could not find a lua table for `" + key + "`. :frowning:") + event.getChannel() + .sendMessage("I could not find a lua table for the path [`" + + Arrays.asList(path).stream().collect(Collectors.joining(", ")) + "`] :frowning:") .complete(); return; }