{"_id":"assistant","_rev":"6-e1e70ea1e89cb208a4b7af293bcfff23","name":"assistant","time":{"modified":"2022-06-13T03:34:47.488Z","created":"2015-09-09T14:15:13.865Z","2.2.19":"2015-09-09T14:15:13.865Z","0.1.0":"2016-04-12T08:53:57.807Z","0.1.1":"2016-04-12T09:24:13.862Z"},"maintainers":[{"name":"jdrydn","email":"james@jdrydn.com"}],"dist-tags":{"latest":"0.1.1"},"description":"A bot to assist with day-to-day operations","readme":"![Hello there](https://github.com/assistant-js/assistant/wiki/icon.jpg)\n\n# Assistant\n## A bot to assist with day-to-day operations\n\nThis is a self-hosted bot service similar to [Hubot](https://hubot.github.com/) (except it's not written in\n[coffeescript](https://github.com/raganwald-deprecated/homoiconic/blob/master/2011/12/jargon.md)!) that executes\narbitrary commands to perform certain actions with a variety of adapters to allow it to run on any platform,\nsimultaneously.\n\n## Why?\n\nHubot is great. The concept of knocking together a quick script to perform simple tasks, perfect! But Hubot is not.\nIgnoring the *coffeescript* source (because when did we start labelling a project as \"bad\" because of the source\nlanguage?) it can't function across multiple adapters, and in order to get around this problem you are forced to run\nmultiple Hubot processes per adapter. That's where Assistant comes in.\n\n## Installation\n\n```sh\n$ npm install --save assistant\n```\n\nThe default installation doesn't come with any adapters but it does come with a selection of scripts to help you test\nyour bot, and hey who doesn't love an automated service that replies to your \"*Hello*\" :wink:\n\n## Usage\n\nMost of the configuration for the Assistant can be in your `package.json` file, although you can specify additional\nconfig files as you see fit. A typical `package.json` file would look like:\n\n```json\n{\n  \"name\": \"Baymax\",\n  \"version\": \"0.1.0\",\n  \"description\": \"Your personal healthcare companion\",\n  \"private\": true,\n  \"scripts\": {\n    \"start\": \"assistant-server\"\n  },\n  \"dependencies\": {\n    \"assistant\": \"^0.1.0\"\n  },\n  \"assistant-adapters\": {\n    \"telegram\": \"assistant-adapter-telegram\"\n  },\n  \"assistant-config\": {\n    \"adapters\": {\n      \"telegram\": {\n        \"token\": \"1926482dcb7fac2585775a65a7b98611ed969af\"\n      }\n    },\n    \"http\": {\n      \"hostname\": \"0.0.0.0\",\n      \"port\": 4000\n    }\n  }\n}\n```\n\nAnd to boot the server you would use:\n\n```sh\n$ npm start\n```\n\nThat just boots an empty bot. Now we can add some adapters and start plugging your bot into your services!\n\n## Adapters\n\nTo add adapters, install the relevant adapter and add it to your `package.json` file under `assistant-adapters`:\n\n```json\n{\n  \"assistant-adapters\": {\n    \"telegram\": \"assistant-adapter-telegram\"\n  },\n  \"assistant-config\": {\n    \"adapters\": {\n      \"telegram\": {\n        \"token\": \"1926482dcb7fac2585775a65a7b98611ed969af\"\n      }\n    }\n  }\n}\n```\n\nConfiguration for adapters goes under `assistant-config.adapters`, and the key should match the key in the\n`assistant-adapters`. Assistant doesn't come bundled with any adapters, so you need to install enough adapters to suit\neach of your service. For now I've written two, [one for Telegram](https://github.com/assistant-js/assistant-adapter-telegram)\nand [one for a shell](https://github.com/assistant-js/assistant-adapter-shell), although I plan to make one for various Slack\ninteractions very soon!\n\n### Known Adapters\n\n- [Telegram Adapter](https://github.com/assistant-js/assistant-adapter-telegram)\n- [Shell Adapter](https://github.com/assistant-js/assistant-adapter-shell)\n\nIf you're interested in writing your own services interaction,\n[check out the Adapters wiki page](https://github.com/assistant-js/assistant/issues/wiki/Adapters).\n\n## Scripts\n\nNow onto the cool stuff! Scripts are individual files that you use to give power to your bot! All you have to do is\nregister listeners to your assistant based on regular expressions (just like Hubot - if it isn't broken don't fix it).\nTo demonstrate, here's [the `hello.js` script](https://github.com/assistant-js/assistant/blob/master/actions/hello.js)\nthat's included with Assistant:\n\n```js\nmodule.exports = function (assistant) {\n  var hellos = [\n    'Well hello there, NAME',\n    'Hey NAME, hello!',\n    'Whaddup NAME',\n    'Good day, NAME',\n    'How\\'s it going, NAME',\n    'How can I help, NAME?'\n  ];\n\n  var mornings = [\n    'Good morning, NAME!',\n    'Good morning to you too, NAME!',\n    'Good day, NAME',\n    'Good \\'aye, NAME'\n  ];\n\n  assistant.hear(/(^hello|good( [d'])?ay(e)?)/i, function (message) {\n    message.reply(message.random(hellos).replace('NAME', message.author.name));\n  });\n\n  assistant.hear(/(^(good )?m(a|o)rnin(g)?)/i, function (message) {\n    message.reply(message.random(mornings).replace('NAME', message.author.name));\n  });\n};\n```\n\nThis script demonstrates some of the features of the assistant:\n\n- Attach functions to listeners based on regular expressions\n- Functions take a single `(message)` argument for synchronous functions, and two arguments `(message, callback)` for\n  asynchronous functions.\n- Because regular expressions, there may be a chance your function will run with other listeners, so be wary :wink:\n- For ease of variance, each `message` has a `random` function that will return a random element from an array of\n  responses, so you can make your assistant sound more life-like!\n\nMessages have the following properties:\n\n```\n{\n  name: 'The name of the Assistant, defaults to {name} from package.json',\n  identifier: 'An identifier for this bot, defaults to {name-version} from package.json',\n  environment: 'The Node-JS environment, in lowercase',\n\n  // The author object comes from the adapter, detailing who this person is\n  // At a minimum, an ID and a Name is present. More properties may be present depending on the adapter, but always\n  //   have some defaults at the ready!\n  author: {\n    id: 'some-unique-id',\n    name: 'Some Relevant Name'\n  },\n\n  // A source object detailing the original request that hit the adapter\n  source: {\n    name: 'Telegram',\n    slug: 'telegram',\n    update_id: 1232942,\n    message: { '...': '...' }\n  },\n\n  // The raw message from the adapter\n  message: req.message.message,\n\n  // An array of matches returned from `regex.exec` so you can capture input for your script\n  matches: [ 'hello', 'hello', undefined, undefined, index: 0, input: 'hello' ],\n\n  // Adds each string argument to the immediate response\n  reply: function reply(string[, string[, ...]]) { },\n  // For delayed responses, you can call `adapter.send` directly (aliased as `message.send`)\n  send: function send(messages, callback) { }\n}\n```\n\n## Questions\n\n- Questions? Awesome! [Open an issue](https://github.com/assistant-js/assistant/issues) or feel free to\n  [tweet me](https://twitter.com/jdrydn) and I'll get back to you!\n- Who am I? If you really wanna know [here's my website](https://jdrydn.com)...\n","versions":{"0.1.0":{"name":"assistant","version":"0.1.0","description":"A bot to assist with day-to-day operations","scripts":{"coveralls":"cat coverage/lcov.info | coveralls","pretest":"jshint . && jscs .","test":"istanbul cover _mocha -- -r should tests/**/*.test.js","posttest":"istanbul check-coverage","preversion":"npm test","postversion":"git push && git push --tags"},"bin":{"assistant-server":"./bin/assistant-server.js"},"files":["actions","bin","src","config.json","adapters.js","index.js","shell-adapter.js"],"author":{"name":"James D","email":"james@jdrydn.com","url":"https://www.jdrydn.com"},"license":"MIT","dependencies":{"async":"^2.0.0-rc.2","body-parser":"^1.15.0","debug":"^2.2.0","express":"^4.13.4","glob":"^7.0.3","lodash":"^4.8.2","morgan":"^1.7.0","request":"^2.70.0"},"devDependencies":{"coveralls":"^2.11.9","istanbul":"^0.4.2","jscs":"^2.11.0","jshint":"^2.9.1","mocha":"^2.4.5","rewire":"^2.5.1","should":"^8.3.0","supertest":"^1.2.0"},"gitHead":"8f26a232827cc49a4f1cca2ec48c94f7db58961c","_id":"assistant@0.1.0","_shasum":"d802c45dab3f7d36996c4ef79d821511d8fa143e","_from":".","_npmVersion":"3.5.3","_nodeVersion":"4.2.4","_npmUser":{"name":"jdrydn","email":"james@jdrydn.com"},"dist":{"shasum":"d802c45dab3f7d36996c4ef79d821511d8fa143e","tarball":"https://registry.npmjs.org/assistant/-/assistant-0.1.0.tgz","integrity":"sha512-HOdzRCh46jzm1mLjbl+E2Odf8B2tQdoD5J2KZrzrmbSHUHWKURj6eoV4GtfAVKm9/b6oOJg/k55SW/tFReiidg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBBwQnGImB+UhoL7PW4tWSXP6FWR3OGlzdKBsDlFS8wpAiEAv9Z9cUqGEd/L2B2ET2QZzFPwBPWSC6TDfp0gEAP0ilE="}]},"maintainers":[{"name":"jdrydn","email":"james@jdrydn.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/assistant-0.1.0.tgz_1460451236404_0.8926036353223026"}},"0.1.1":{"name":"assistant","version":"0.1.1","description":"A bot to assist with day-to-day operations","scripts":{"coveralls":"cat coverage/lcov.info | coveralls","pretest":"jshint . && jscs .","test":"istanbul cover _mocha -- -r should tests/**/*.test.js","posttest":"istanbul check-coverage","preversion":"npm test","postversion":"git push && git push --tags"},"bin":{"assistant-server":"./bin/assistant-server.js"},"files":["actions","bin","src","config.json","adapters.js","index.js","shell-adapter.js"],"author":{"name":"James D","email":"james@jdrydn.com","url":"https://www.jdrydn.com"},"license":"MIT","dependencies":{"async":"^2.0.0-rc.2","body-parser":"^1.15.0","debug":"^2.2.0","express":"^4.13.4","glob":"^7.0.3","lodash":"^4.8.2","morgan":"^1.7.0","request":"^2.70.0"},"devDependencies":{"coveralls":"^2.11.9","istanbul":"^0.4.2","jscs":"^2.11.0","jshint":"^2.9.1","mocha":"^2.4.5","rewire":"^2.5.1","should":"^8.3.0","supertest":"^1.2.0"},"gitHead":"6fa7ead80ab1425cf0cfd2948a6db6b9dcf30086","_id":"assistant@0.1.1","_shasum":"a398959caf38bf72badded9b84831ec72e92839c","_from":".","_npmVersion":"3.5.3","_nodeVersion":"4.2.4","_npmUser":{"name":"jdrydn","email":"james@jdrydn.com"},"dist":{"shasum":"a398959caf38bf72badded9b84831ec72e92839c","tarball":"https://registry.npmjs.org/assistant/-/assistant-0.1.1.tgz","integrity":"sha512-IxmyTOVpdWh7JwpRdPXmmVtnOBKtbprieUib3b68q6nb/zblefqSfwWzwu7fErzKQntu2QE43FApbNFev3Q3Hw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCW9+Yys//QFe5dtHWYPa9jS1l/WCy3VqdLd+gd2vk6wgIhAN5FsPA+wVNJfFIK/Og0x41s0g4dGMd09RF6X8iOpxWl"}]},"maintainers":[{"name":"jdrydn","email":"james@jdrydn.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/assistant-0.1.1.tgz_1460453051310_0.4141905445139855"}}},"author":{"name":"James D","email":"james@jdrydn.com","url":"https://www.jdrydn.com"},"license":"MIT","readmeFilename":"README.md"}