diff --git a/ADAM/adam.js b/ADAM/adam.js index 5e4a9b1..63ec612 100644 --- a/ADAM/adam.js +++ b/ADAM/adam.js @@ -14,7 +14,7 @@ let shared = require("../Shared/shared"); //dialog system let dialog = shared.GenerateDialogFunction(require("./dialog.json")); -//ADAM dialog decorator +//dialog decorator dialog = function(baseDialog) { return function(key, ...data) { if ( (key === "help" || key === "lore") && typeof(data[0]) !== "undefined") { @@ -27,7 +27,7 @@ dialog = function(baseDialog) { let result = baseDialog(key, ...data); if (result === "") { - return "No result for \"" + key + "\""; + return dialog("noResult", key); } return result; } @@ -152,16 +152,6 @@ function processBasicCommands(client, message) { message.delete(1000); } return true; - - case "help": - case "lore": - shared.SendPublicMessage(client, message.author, message.channel, dialog(command, args[0])); - return true; - - //DEBUGGING - case "debugxp": - shared.AddXP(client, message.author, args[0]); - return true; } return false; diff --git a/ADAM/dialog.json b/ADAM/dialog.json index f6ee4f0..093769e 100644 --- a/ADAM/dialog.json +++ b/ADAM/dialog.json @@ -92,5 +92,7 @@ "loreSanctum": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon.", "loreLibrarian": "WARNING: DATA CORRUPTED", "loreCodex": "WARNING: DATA CORRUPTED", - "loreFactions": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon." + "loreFactions": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon.", + + "noResult": "No result for \"{1}\"" } diff --git a/ADAM_CptMon/adam-cptmon.js b/ADAM_CptMon/adam-cptmon.js index 8ceb7cb..f482ef4 100644 --- a/ADAM_CptMon/adam-cptmon.js +++ b/ADAM_CptMon/adam-cptmon.js @@ -13,6 +13,25 @@ let shared = require("../Shared/shared"); //dialog system let dialog = shared.GenerateDialogFunction(require("./dialog.json")); +//dialog decorator +dialog = function(baseDialog) { + return function(key, ...data) { + if ( (key === "help" || key === "lore") && typeof(data[0]) !== "undefined") { + //force the arg into camelCase + arg = data[0].toLowerCase(); + arg = arg.charAt(0).toUpperCase() + arg.substr(1); + key += arg; + } + + let result = baseDialog(key, ...data); + + if (result === "") { + return dialog("noResult", key); + } + return result; + } +}(dialog); + //handle errors client.on('error', console.error); @@ -98,6 +117,16 @@ function processBasicCommands(client, message) { message.delete(1000); } return true; + + case "help": + case "lore": + //skip the gate channel + if (message.channel.id === process.env.GATE_CHANNEL_ID) { + return true; + } + + shared.SendPublicMessage(client, message.author, message.channel, dialog(command, args[0])); + return true; } return false; diff --git a/ADAM_CptMon/dialog.json b/ADAM_CptMon/dialog.json index f6ee4f0..093769e 100644 --- a/ADAM_CptMon/dialog.json +++ b/ADAM_CptMon/dialog.json @@ -92,5 +92,7 @@ "loreSanctum": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon.", "loreLibrarian": "WARNING: DATA CORRUPTED", "loreCodex": "WARNING: DATA CORRUPTED", - "loreFactions": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon." + "loreFactions": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon.", + + "noResult": "No result for \"{1}\"" } diff --git a/ADAM_Dairo/adam-dairo.js b/ADAM_Dairo/adam-dairo.js index dad4bf4..bac002c 100644 --- a/ADAM_Dairo/adam-dairo.js +++ b/ADAM_Dairo/adam-dairo.js @@ -13,6 +13,25 @@ let shared = require("../Shared/shared"); //dialog system let dialog = shared.GenerateDialogFunction(require("./dialog.json")); +//dialog decorator +dialog = function(baseDialog) { + return function(key, ...data) { + if ( (key === "help" || key === "lore") && typeof(data[0]) !== "undefined") { + //force the arg into camelCase + arg = data[0].toLowerCase(); + arg = arg.charAt(0).toUpperCase() + arg.substr(1); + key += arg; + } + + let result = baseDialog(key, ...data); + + if (result === "") { + return dialog("noResult", key); + } + return result; + } +}(dialog); + //handle errors client.on('error', console.error); @@ -98,6 +117,16 @@ function processBasicCommands(client, message) { message.delete(1000); } return true; + + case "help": + case "lore": + //skip the gate channel + if (message.channel.id === process.env.GATE_CHANNEL_ID) { + return true; + } + + shared.SendPublicMessage(client, message.author, message.channel, dialog(command, args[0])); + return true; } return false; diff --git a/ADAM_Dairo/dialog.json b/ADAM_Dairo/dialog.json index f6ee4f0..093769e 100644 --- a/ADAM_Dairo/dialog.json +++ b/ADAM_Dairo/dialog.json @@ -92,5 +92,7 @@ "loreSanctum": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon.", "loreLibrarian": "WARNING: DATA CORRUPTED", "loreCodex": "WARNING: DATA CORRUPTED", - "loreFactions": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon." + "loreFactions": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon.", + + "noResult": "No result for \"{1}\"" } diff --git a/ADAM_Kamala/adam-kamala.js b/ADAM_Kamala/adam-kamala.js index cf85015..b6bd839 100644 --- a/ADAM_Kamala/adam-kamala.js +++ b/ADAM_Kamala/adam-kamala.js @@ -13,6 +13,25 @@ let shared = require("../Shared/shared"); //dialog system let dialog = shared.GenerateDialogFunction(require("./dialog.json")); +//dialog decorator +dialog = function(baseDialog) { + return function(key, ...data) { + if ( (key === "help" || key === "lore") && typeof(data[0]) !== "undefined") { + //force the arg into camelCase + arg = data[0].toLowerCase(); + arg = arg.charAt(0).toUpperCase() + arg.substr(1); + key += arg; + } + + let result = baseDialog(key, ...data); + + if (result === "") { + return dialog("noResult", key); + } + return result; + } +}(dialog); + //handle errors client.on('error', console.error); @@ -98,6 +117,16 @@ function processBasicCommands(client, message) { message.delete(1000); } return true; + + case "help": + case "lore": + //skip the gate channel + if (message.channel.id === process.env.GATE_CHANNEL_ID) { + return true; + } + + shared.SendPublicMessage(client, message.author, message.channel, dialog(command, args[0])); + return true; } return false; diff --git a/ADAM_Kamala/dialog.json b/ADAM_Kamala/dialog.json index f6ee4f0..093769e 100644 --- a/ADAM_Kamala/dialog.json +++ b/ADAM_Kamala/dialog.json @@ -92,5 +92,7 @@ "loreSanctum": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon.", "loreLibrarian": "WARNING: DATA CORRUPTED", "loreCodex": "WARNING: DATA CORRUPTED", - "loreFactions": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon." + "loreFactions": "TODO: Sorry. I recognize the term but am unable to process the request. There is a corruption in my cognitive core. Try again soon.", + + "noResult": "No result for \"{1}\"" } diff --git a/Librarian/dialog.json b/Librarian/dialog.json index b2bf0c2..09e224c 100644 --- a/Librarian/dialog.json +++ b/Librarian/dialog.json @@ -51,5 +51,5 @@ "heal": "THIS IS A LIBRARY. NOT A PLACE FOR HEALING.", "read": "PLEASE CHOOSE A BOOK: !book [name].", - "unknown": "UNKNOWN" + "noResult": "UNKNOWN" } \ No newline at end of file diff --git a/Librarian/librarian.js b/Librarian/librarian.js index 1c1d1c4..f4eccb5 100644 --- a/Librarian/librarian.js +++ b/Librarian/librarian.js @@ -27,7 +27,7 @@ dialog = function(baseDialog) { let result = baseDialog(key, ...data); if (result === "") { - return baseDialog("unknown"); + return baseDialog("noResult"); } return result; }