diff --git a/bot.js b/bot.js index cf5b4e2..7f16436 100644 --- a/bot.js +++ b/bot.js @@ -1,6 +1,7 @@ //All the custom stuff, separated by converns const dungeonary = require('./dungeonary') const discordlib = require('./discordlib') +const gravemind = require('./gravemind') //TODO: Map all the libs at boot, so there isn't a loop to find each op. Way better. //var knownOps = []; for ( func in req('./lib') ){ knownOps[func] = lib[func] } @@ -22,7 +23,7 @@ client.on('ready', () => { if (process.env.NODE_ENV) { console.log(`${process.env.NODE_ENV} mode activated!`) } - console.log(`I'm rolling initiative as ${client.user.tag}!`) + console.log(`Tavernbot v${process.env.npm_package_version} has logged in as ${client.user.tag}!`) client.user.setPresence({ "status": "online", "game": { "name": gameStatus } @@ -47,6 +48,9 @@ client.on('message', msg => { } else if (cmd in discordlib) { console.log(execTime + 'running discordlib.' + cmd + '(' + input + ') for ' + msg.author.username) msg.reply(discordlib[cmd](input, msg, client)) + } else if (cmd in gravemind) { + console.log(execTime + 'running gravemind.' + cmd + '(' + input + ') for ' + msg.author.username) + msg.reply(gravemind[cmd](input, msg, client)) } else { console.log(execTime + ' WARN: failed to run ' + cmd + '(' + input + ') for ' + msg.author.username) } diff --git a/gravemind/index.js b/gravemind/index.js new file mode 100644 index 0000000..17b8cbc --- /dev/null +++ b/gravemind/index.js @@ -0,0 +1,14 @@ +// List all local components here +const components = [ + './sysinfo' +] + +// Go through each chunk of the library and set each exported +// function as its own export of this module +for (sublib of components) { + let lib = require(sublib) + for (operation in lib) { + exports[operation] = lib[operation] + } + console.log(sublib + " loaded!") +} diff --git a/gravemind/sysinfo.js b/gravemind/sysinfo.js new file mode 100644 index 0000000..7b8efd1 --- /dev/null +++ b/gravemind/sysinfo.js @@ -0,0 +1,15 @@ +// Simple version, bug link, and release notes output +exports.version = function() { + let response = `I am Tavernbot v**${process.env.npm_package_version}**!\n\n` + response += `**Release notes**\n${process.env.npm_package_releasenotes}\n\n` + response += `**Bug or feature request? Drop it here!**\n${process.env.npm_package_bugs_url}\n` + return response +} + +// Util calls for the github issues link +exports.bug = function() { + return `if you found a bug, please report it here: ${process.env.npm_package_bugs_url}` +} +exports.feedback = exports.request = exports.feature = function() { + return `got a feature idea or some feedback? Awesome! Let me know here: ${process.env.npm_package_bugs_url}` +} \ No newline at end of file diff --git a/package.json b/package.json index 89df1d5..5ccd288 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "tavernbot", "version": "0.1.3", + "releasenotes": "This is a test release, and is currently under heavy development. Feel that? Change. It's in the air.", "description": "A Dungeons and Dragons GM bot for discord, written in Node. This bot supports common tabletop RPG functionality, common Discord operations, and more", "main": "bot.js", "scripts": { - "bot": "node bot.js", + "start": "node bot.js", "devbot": "nodemon bot.js", "test": "node test.js", "build": "echo Placeholder text for smushing libs into an rpgapp.js for web page usage" @@ -45,4 +46,4 @@ "devDependencies": { "nodemon": "^1.17.2" } -} +} \ No newline at end of file