Added NPC images

This commit is contained in:
2018-11-01 05:02:21 +11:00
parent 21081d7f0d
commit e4b1434c91
19 changed files with 0 additions and 0 deletions

55
BOT_Librarian/dialog.json Normal file
View File

@@ -0,0 +1,55 @@
{
"help": "PLEASE CHOOSE A SUBJECT: lore [subject]. TYPE !subjects FOR A LIST OF SUBJECTS.",
"lore": "PLEASE CHOOSE A SUBJECT: lore [subject]. TYPE !subjects FOR A LIST OF SUBJECTS.",
"subjects": "SUBJECTS ARE: adam, kamala, captain, dairo, ghost, alexis, mori, mosiah, rey\n\nType !more1 for more.",
"loreAdam": "THE SHEPARD OF THE PEOPLE. THERE IS MORE TO HIM THAN MEETS THE LIGHT RECEPTOR. I DON'T LIKE HIM.",
"loreKamala": "MONEY-HUNGRY, BACK-STABBING, GREEDY-GUTS. EASY TO PREDICT. I LIKE HER.",
"loreCaptain": "CAPTAIN MONTGOMERY. FINE, UPSTANDING OFFICER OF LAW AND JUSTICE. EASY TO PREDICT. I LIKE HIM.",
"loreDairo": "DEVOUT TO A FAULT. BELIEVES HIS OWN TEACHINGS. EASY TO PREDICT. I LIKE HIM.",
"loreGhost": "UNKNOWN, GATHERING DATA. BE CAUTIOUS.",
"loreAlexis": "CHEMIST. BARTENDER. INFORMANT. EASY TO PREDICT. I LIKE HER.",
"loreMori": "DOCTOR. INTELLIGENT. DANGEROUS. DIFFICULT TO PREDICT. I DON'T LIKE HIM.",
"loreMosiah": "UNKNOWN, GATHERING DATA. BE CAUTIOUS.",
"loreRey": "UNKNOWN, GATHERING DATA. BE CAUTIOUS.",
"more1": "SUBJECTS ARE: city, obsidian, genesis, hand, librarian, crystals, eve, secrets\n\nType !more2 for more.",
"loreCity": "THE CITY. ALSO KNOWN AS SANCTUM. CONSTRUCTED FOR HUMANS.",
"loreObsidian": "CORPORATION. FACTION. BUSINESS LIKE. EASY TO PREDICT. I LIKE THEM.",
"loreGenesis": "COMMAND STRUCTURE. FACTION. LAW ENFORCERS. EASY TO PREDICT. I LIKE THEM.",
"loreHand": "RELIGION. FACTION. DEVOUT WORSHIPPERS OF TECHNOLOGY. EASY TO PREDICT. I LIKE THEM.",
"loreLibrarian": "ME. SENTINEL. AWAITING !signal.",
"loreCrystals": "PINKISH-PURPLE CRYSTALS. EDIBLE. USED AS NUTRIENTS AND CURRENCY.",
"loreEve": "WARNING WARNING WARNING DO NOT APPROACH EVE.",
"loreSecrets": "EVERY CITY HAS IT'S SECRETS. THIS ONE IS NO EXCEPTION.",
"loreSignal": "I MUST WAIT FOR THE signal.",
"signal": "I CANNOT INITIATE THE signal. I MUST WAIT FOR THE signal.",
"more2": "SUBJECTS ARE: about, games, books, library, tavern, bugs\n\nType !more4 for more.",
"loreAbout": "CREATED BY THE WONDERFUL FOLKS AT GAME DEV UNDERGROUND.",
"loreGames": "THIS IS A LIBRARY. NOT A PLACE FOR GAMES.",
"loreBooks": "PLEASE CHOOSE A BOOK: !book [name].",
"loreLibrary": "THERE ARE 114,327 BOOKS CATALOGUED AND ARCHIVED WITHIN THIS LIBRARY. THE CONTENTS OF THIS LIBRARY IS ESTIMATED TO BE 23% CATALOGUED AND ARCHIVED.",
"loreTavern": "THIS IS A LIBRARY. NOT A PLACE FOR DRINKS.",
"loreBugs": "WHERE?",
"more3": "data expunged -A.D.A.M.",
"more4": "SUBJECTS ARE: ",
"more5": "SUBJECTS ARE: ",
"more6": "SUBJECTS ARE: ",
"book": "THAT BOOK IS NOT CATALOGUED OR ARCHIVED.",
"bookCodex": "codex HAS BEEN REMOVED FROM THE LIBRARY FOR CLEANING.",
"buydrink": "THIS IS A LIBRARY. NOT A PLACE FOR DRINKS.",
"heal": "THIS IS A LIBRARY. NOT A PLACE FOR HEALING.",
"read": "PLEASE CHOOSE A BOOK: !book [name].",
"noResult": "UNKNOWN"
}

117
BOT_Librarian/librarian.js Normal file
View File

@@ -0,0 +1,117 @@
// .env Variables
require('dotenv').config({path: '../.env'});
// Node Modules
let discord = require('discord.js');
let client = new discord.Client();
//let cron = require('node-cron');
// Bot Modules
let npcSettings = require('./npcSettings');
let shared = require("../Shared/shared");
//dialog system
let dialog = shared.GenerateDialogFunction(require("./dialog.json"));
//ADAM dialog decorator
//NOTE: This isn't strictly necessary for the bots
dialog = function(baseDialog) {
return function(key, ...data) {
if ( (key === "help" || key === "lore" || key == "book") && 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 baseDialog("noResult");
}
return result;
}
}(dialog);
//handle errors
client.on('error', console.error);
// The ready event is vital, it means that your bot will only start reacting to information from discord _after_ ready is emitted
client.on('ready', async () => {
// Generates invite link
try {
let link = await client.generateInvite(["ADMINISTRATOR"]);
console.log("Invite Link: " + link);
} catch(e) {
console.log(e.stack);
}
// You can set status to 'online', 'invisible', 'away', or 'dnd' (do not disturb)
client.user.setStatus('online');
// Sets your "Playing"
if (npcSettings.activity) {
client.user.setActivity(npcSettings.activity, { type: npcSettings.type })
//DEBUGGING
.then(presence => console.log("Activity set to " + (presence.game ? presence.game.name : 'none')) )
.catch(console.error);
}
console.log("Logged in as: " + client.user.username + " - " + client.user.id);
});
// Create an event listener for messages
client.on('message', async message => {
// Ignores ALL bot messages
if (message.author.bot) {
return;
}
//skip the statis channel
if (message.channel.id === process.env.STASIS_CHANNEL_ID) {
return;
}
//skip the gate channel
if (message.channel.id === process.env.GATE_CHANNEL_ID) {
return;
}
// Has to be (prefix)command
if (message.content.indexOf(process.env.PREFIX) !== 0) {
return;
}
if (processBasicCommands(client, message)) {
return;
}
});
//Log our bot in
client.login(npcSettings.token);
function processBasicCommands(client, message) {
// "This is the best way to define args. Trust me."
// - Some tutorial dude on the internet
let args = message.content.slice(process.env.PREFIX.length).trim().split(/ +/g);
let command = args.shift().toLowerCase();
switch (command) {
case "ping":
if (shared.IsAdmin(client, message.author)) {
shared.SendPublicMessage(client, message.author, message.channel, "PONG!");
}
return true;
case "help":
case "lore":
shared.SendPublicMessage(client, message.author, message.channel, dialog(command, args[0]));
return true;
default:
shared.SendPublicMessage(client, message.author, message.channel, dialog(command));
return true;
}
return false;
}

View File

@@ -0,0 +1,7 @@
require('dotenv').config({path: '../.env'});
module.exports = {
activity: "for the signal.",
type: "WATCHING",
token: process.env.LIBRARIAN_TOKEN,
}

View File

@@ -0,0 +1,20 @@
{
"name": "Librarian",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "forever -o forever.log -e error.log start librarian.js",
"restart": "forever -o forever.log -e error.log restart librarian.js",
"stop": "forever stop librarian.js",
"node": "node librarian.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^11.4.2",
"dotenv": "^6.1.0",
"forever": "^0.15.3",
"node-cron": "^1.2.1"
}
}