From 3f06204ff52463ed5f1720322e0088680cbe4ff9 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Mon, 22 Oct 2018 12:09:31 +1100 Subject: [PATCH] Intros are now layed out manually --- ADAM/adam.js | 53 ++++++++++++++++++++++++++++++++++++++++-------- ADAM/dialog.json | 2 +- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/ADAM/adam.js b/ADAM/adam.js index e9c78ae..3edf616 100644 --- a/ADAM/adam.js +++ b/ADAM/adam.js @@ -65,13 +65,6 @@ client.on('ready', async () => { console.log('Updating STAMINA every 2 min.'); dataRequest.sendServerData("updateStamina"); }); - - //ADAM prints the intros in the gate - shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("intro")); - shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introObsidian", process.env.GROUP_A_ROLE)); - shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introGenesis", process.env.GROUP_B_ROLE)); - shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introHand", process.env.GROUP_C_ROLE)); - shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introEnd")); }); // Create an event listener for messages @@ -101,7 +94,7 @@ client.on('message', async message => { } //check if can continue (used primarily by the faction leaders) - if (shared.CheckValidDisplay(client, message.member, message.channel)) { + if (!shared.CheckValidDisplay(client, message.member, message.channel)) { return; } @@ -126,6 +119,11 @@ function processGateCommands(message) { //WARNING: string constants used here + //if laying out the intro + if (command.substr(0, 5) === "intro") { + return false; + } + //if they haven't chosen a faction if (!(command === "obsidian" || command === "genesis" || command === "hand")) { message.reply("Please choose one of the factions by typing your desired faction shown above (!genesis, !obsidian, or !hand).") @@ -159,6 +157,43 @@ function processBasicCommands(message) { case "hand": //TODO: move this to the other bots return processFactionChangeAttempt(client, message, process.env.GROUP_C_ROLE, "Hand"); + //ADAM and the faction leaders print the intros in the gate + //TODO: prune the unneeded intros from each bot + case "intro": + if (shared.IsAdmin(client, message.author)) { + shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("intro")); + message.delete(1000); + } + return true; + + case "introobsidian": + if (shared.IsAdmin(client, message.author)) { + shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introObsidian", process.env.GROUP_A_ROLE)); + message.delete(1000); + } + return true; + + case "introgenesis": + if (shared.IsAdmin(client, message.author)) { + shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introGenesis", process.env.GROUP_B_ROLE)); + message.delete(1000); + } + return true; + + case "introhand": + if (shared.IsAdmin(client, message.author)) { + shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introHand", process.env.GROUP_C_ROLE)); + message.delete(1000); + } + return true; + + case "introend": + if (shared.IsAdmin(client, message.author)) { + shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introEnd")); + message.delete(1000); + } + return true; + case "help": case "lore": shared.SendPublicMessage(client, message.author, message.channel, dialog(command, args[0])); @@ -306,7 +341,7 @@ function processFactionChangeAttempt(client, message, factionRole, factionShorth shared.SendPublicMessage(client, message.channel, dialog("conversionLocked", message.author.id)); break; case "createdUser": - shared.SendPublicMessage(client, message.author, message.channel, dialog("newUserPublicMessage", shared.GetFactionName(factionRole), "TODO: factionChannel")); + shared.SendPublicMessage(client, message.author, shared.GetFactionChannel(factionRole), dialog("newUserPublicMessage", shared.GetFactionName(factionRole), shared.GetFactionChannel(factionRole))); shared.SendPrivateMessage(client, message.author, dialog("newUserPrivateMessage", dialog("newUserPrivateMessageRemark" + factionShorthand))); break; case "joined": diff --git a/ADAM/dialog.json b/ADAM/dialog.json index 58929e1..f6ee4f0 100644 --- a/ADAM/dialog.json +++ b/ADAM/dialog.json @@ -65,7 +65,7 @@ "alreadyJoinedHand": ":x: <@{1}> The Hand is happy to have you in their congregation already. There's no need to request a change.", "joinHand": "You may now spread the word of the Hand. May the gods look favourably upon you.", - "newUserPublicMessage": "Welcome to {1}. If you need me for anything, you can contact me via this secure channel. Just use **!help** for a list of things I can do for you.\n\nAnd don't forget to say hello to your fellow travelers in {2}.", + "newUserPublicMessage": "Welcome to {1}. If you need me for anything, you can contact me via this secure channel. Just use **!help** for a list of things I can do for you.\n\nAnd don't forget to say hello to your fellow travelers in <#{2}>.", "newUserPrivateMessage": "*Traveler, welcome to The Sanctum.*\n\n{1}\n\nI'll get you patched up and give you access to our team to upgrade skills and meet the others. There's just a few things I need you to take care of around the city:\n\n**!checkin** with me daily.\n```Once a day I'll give you your daily allotment of crystals in exchange for some help around the city.```\n**!attack** any Ravagers in #the-deadlands.\n```With the constant bombardment from the enemies of the city, It's hard to keep us safe. I need your help```\n\n*Good luck. I'll be around if you need me.*", "newUserPrivateMessageRemarkObsidian": "I see that you've joined **Obsidian Technologies**. While they are the most chaotic of the 3 factions, I can see why you'd pick them. The Codex is a very powerful book, and should you be victorious, everyone will have equal access to it's secrets. TODO",