{"_id":"@amazebot/rocket-bot","_rev":"3-ddb38dacd6fd5b3f6b2ffa7cb9780675","name":"@amazebot/rocket-bot","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@amazebot/rocket-bot","version":"0.1.0","description":"Consume Rocket.Chat message streams and automate method calls.","homepage":"https://github.com/Amazebot/rocket-control/tree/master/packages/bot","repository":{"type":"git","url":"git+ssh://git@github.com/Amazebot/rocket-control.git"},"author":{"name":"Tim Kinnane","email":"tim.kinnane@amazebot.chat"},"license":"MIT","engines":{"node":"> 8.0.0","npm":"> 5.0.0"},"main":"lib/index.js","types":"lib/index.d.ts","directories":{"lib":"lib"},"keywords":["rocket.chat","chat","chatops","messaging","CUI","typescript","chatbot"],"publishConfig":{"access":"public"},"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","add:local":"yarn add --registry http://localhost:4873"},"dependencies":{"@amazebot/config":"^0.1.1","@amazebot/logger":"^0.1.1","@amazebot/rocket-rest":"^0.2.0","@amazebot/rocket-sims":"^0.1.0","@amazebot/rocket-socket":"^0.1.0","@types/lru-cache":"^4.1.1","lru-cache":"^5.1.1"},"gitHead":"682d3d28faefd214cea98c658e8f9ee56d6ac2d7","bugs":{"url":"https://github.com/Amazebot/rocket-control/issues"},"_id":"@amazebot/rocket-bot@0.1.0","_nodeVersion":"11.8.0","_npmVersion":"lerna/3.13.0/node@v11.8.0+x64 (darwin)","_npmUser":{"name":"timkinnane","email":"timkinnane@gmail.com"},"dist":{"integrity":"sha512-1znHwsnsaglAunGKFILlbQsnzSjOliO2yHsOdiYJLEZCBPy7G5g1SdYEHOmaK7t38aXnZ3lb/iblWfgaMXsMUQ==","shasum":"02809a62a1bc6d6d66bc88d3747eabdee80b107b","tarball":"https://registry.npmjs.org/@amazebot/rocket-bot/-/rocket-bot-0.1.0.tgz","fileCount":4,"unpackedSize":7397,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcdnggCRA9TVsSAnZWagAAAiwP/A0fic2GzADjOePXEqdK\nwOBTm2BLlsCunwbW3SO3oww5+R4fP916fauhNBnxB8faltxHuFdMzehF6maY\nSHEY7EBtRNpVHA7bkMk1Xe87WsLvMuwf/2o7K7oqi7UulmummGnSASF4nEes\nRjbZn7n/zvvBKSb04r6H35Ap5Nvua5OLWvKqgSDB13znKHWF1ZXj1Rxsv8iJ\nmtRXya+PoRW7FB8MrOKvVeh5j5+M8/W9nxCjJbZ2OdvZV/dC7qBpYNObhgoc\nWrmZzBPVZXtKFSt+3BDEViGmvDIbn1IGi2D0gFlx2IcX+T3F27UJO4v7YXNn\nKWAcnFTBDqSki6AGPKPssDVGRmCJriuRaVxDRy4tPDJI8rY4pJaR3E6sjFoT\nUDG5x5jo8IffW3VoaSozSNlPgr//01B6tJT2kTaiFAkJE6Z8DA2/huOw/fG0\nR5oqKZoVQlrByxgXjiJfd4qye0a0Wvo3u+W90YJVEiZcgiLBu/s8aWtUhVBE\ntIRkxa2jofPwl2cvoP1imeD847/6mrsEz72WJg7precOOkKNer2mp4SuFWa5\nX8nzzuBZs+FGN3c1ZY70ZF/i+XZOrb2SwyyMj2uSmQJIzEFs1wn+RZgjinSd\nmUM0fcylR3ggcmWedJVvE7mj2KtZKMl54ifq1/6D+bU8YN0o+V6QVEo+TnQZ\nNWFv\r\n=oIYO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCfDzGLVsjeaJq4yGvZFcQfjY8jrfauBhNwM3Z+u7EthAIhAIUTbzN/6fFaOIHdj7XH0BHhdFIAU/MxidXoJr4rCHzm"}]},"maintainers":[{"name":"timkinnane","email":"timkinnane@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rocket-bot_0.1.0_1551267871962_0.20716695810354047"},"_hasShrinkwrap":false},"0.1.1":{"name":"@amazebot/rocket-bot","version":"0.1.1","description":"Consume Rocket.Chat message streams and automate method calls.","homepage":"https://github.com/Amazebot/rocket-control/tree/master/packages/bot","repository":{"type":"git","url":"git@github.com:Amazebot/rocket-control.git"},"author":{"name":"Tim Kinnane","email":"tim.kinnane@amazebot.chat"},"license":"MIT","engines":{"node":"> 8.0.0","npm":"> 5.0.0"},"main":"lib/index.js","types":"lib/index.d.ts","keywords":["rocket.chat","chat","chatops","messaging","CUI","typescript","chatbot"],"publishConfig":{"access":"public"},"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","add:local":"yarn add --registry http://localhost:4873"},"dependencies":{"@amazebot/config":"^0.1.1","@amazebot/logger":"^0.1.1","@amazebot/rocket-rest":"^0.2.0","@amazebot/rocket-sims":"^0.1.0","@amazebot/rocket-socket":"^0.1.0","@types/lru-cache":"^4.1.1","lru-cache":"^5.1.1"},"gitHead":"7dec983c198c2aef561a018ba81f7fb1b10935e6","_id":"@amazebot/rocket-bot@0.1.1","dist":{"shasum":"124887b5e06d2e993198a02ffb2732c9c24066a1","integrity":"sha512-+kbGz/DMwymdseKmqeNhPPmL7+0GUpRGObawF1KRmsOv9fJ6UEwqVXo2lwCq2Nus24we+f2TWRdxNYC0aZThJA==","tarball":"https://registry.npmjs.org/@amazebot/rocket-bot/-/rocket-bot-0.1.1.tgz","fileCount":18,"unpackedSize":53239,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcf8OqCRA9TVsSAnZWagAAT1EP/iGrVvJUpJC69BIuqTZ8\nBqzi5QuImQFnW/IzBDu1iOKuc6Gnq8dm86gNNXoKIDQTbzCQCQZxRPDw9jX0\n8KyjlUyrAFySMmGhv5MphFa/0PsCJiwiCfkczRoriVg80ukYpyJetyu40mLg\nB7IG38OsVgYTfQqDoEQE2lfz1yhKU6W/F4unjfhWpkd8YEp3N4nS5CA6sVyf\nydxKfW11Ae/isnOUbfevA0D+cu5E37wqjfmg8R/XU7lvRiKYTWcEtkdlXLqw\nin4/HxC0MZ5cpavoVcyxHtSjaiXO8OoCLwdEXerrw1kyDVnyD+gJyPoT436/\nNSkjs9XbrFpaqPcPlNFC1OMdoeQxzfobB/KaNSm1GbckhD3vcwshhKPH+uaM\nZsFvZoNES30US4hID4XLChHhAfk9iT+KyAqIFcz0sORXe7ymC6rJx2PT0R6Q\nXyk945rB1HJHRq46c7WGS0hkMtUA14LW6klQAc6Vaa9VO1wNBBr/JWVQoKOB\n6V9cdWxH+EZ6EYzubhQABBIZNLuZQPIsZZ3uFhAvxIvgexP57vqDqFcKE1Nw\n5eRt6BVQXIc/Pah3i6AGNkmTwQa4U3pt/8dEqXhgqHeI1LXj2H4ils9OZR/G\nscZ9QJX0LlJIAUFQUsmR8XCE9mwv2aepS4/Ugr+98lkbQAy4N6lvCnh4grCG\nK6vR\r\n=Hx1K\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD5u3lAtkmZpI0TpMqCSEuSpjlcw0e6EqG6v8y0OUIJEgIhAJVZp1funHRg/afrSSDUE1h7/M3SbOl/NxlzcOnyR37C"}]},"maintainers":[{"name":"timkinnane","email":"timkinnane@gmail.com"}],"_npmUser":{"name":"timkinnane","email":"timkinnane@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rocket-bot_0.1.1_1551877033335_0.37704337806445287"},"_hasShrinkwrap":false},"0.1.2":{"name":"@amazebot/rocket-bot","version":"0.1.2","description":"Consume Rocket.Chat message streams and automate method calls.","homepage":"https://github.com/Amazebot/rocket-control/tree/master/packages/bot","repository":{"type":"git","url":"git+ssh://git@github.com/Amazebot/rocket-control.git"},"author":{"name":"Tim Kinnane","email":"tim.kinnane@amazebot.chat"},"license":"MIT","engines":{"node":"> 8.0.0","npm":"> 5.0.0"},"main":"lib/index.js","types":"lib/index.d.ts","directories":{"lib":"lib"},"keywords":["rocket.chat","chat","chatops","messaging","CUI","typescript","chatbot"],"publishConfig":{"access":"public"},"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","add:local":"yarn add --registry http://localhost:4873"},"dependencies":{"@amazebot/config":"^0.1.1","@amazebot/logger":"^0.1.1","@amazebot/rocket-rest":"^0.2.1","@amazebot/rocket-sims":"^0.1.1","@amazebot/rocket-socket":"^0.1.1","@types/lru-cache":"^4.1.1","lru-cache":"^5.1.1"},"gitHead":"627a1cd05ebd2fa150d24a5914b8de48407214ee","bugs":{"url":"https://github.com/Amazebot/rocket-control/issues"},"_id":"@amazebot/rocket-bot@0.1.2","_nodeVersion":"11.12.0","_npmVersion":"lerna/3.13.0/node@v11.12.0+x64 (darwin)","_npmUser":{"name":"timkinnane","email":"timkinnane@gmail.com"},"dist":{"integrity":"sha512-4HcyT1JEOcNrwfWMvg+NGjxjHEgo/5mjskKXpQYaDB5S3pSt+oAc3Bch6rfjepphGU+IwSPsVnhWtFhU2Jt2og==","shasum":"cc1c93dad1d14e701959043e7f9fc783a5fe21fc","tarball":"https://registry.npmjs.org/@amazebot/rocket-bot/-/rocket-bot-0.1.2.tgz","fileCount":18,"unpackedSize":53487,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcvGn+CRA9TVsSAnZWagAAHjkP/1ZGhGfpfyv62iGPQXsZ\npZ6Wc3NWjtVCSBArqtAmAVhY+4wye6XueaeM9p59u3WqnhsjrMTziPzbQabV\nqtQvblZ6jsa/cg9YNzMLKWbvUmTEXPvHUkPSNudGsjXaLzl0BMBP1yStnOkT\nvBrHSGFynjQaO+OoICE5zZox5EI4QC0JYu+rkNxgyx5yUg26mmoljDH0ZKWL\ndTOHeChtjE+RRODaxeQ+1MhLdzofroR7ep00JPLU9C21TXv4RRlQMOx8AOcQ\n14O5FbZtHiAM9S2hyC6Svpk2LvjYk8DQ5zJMEoEqRRgFRuQRAsMGNChYBXGY\nhRufzUJEKSkDgAx62oROW5ByN6g2WCeQvMxonzIPBwZhgnpgYuIvSMUyGmzE\nD9VRXxOvG2Gd63sKk1oeLVpxextLlq0UM8Wnaw9BHjWjhVpxbL1I613/VaB2\nsdKgvDeX1GueERqi+j1wCqeFpL+5r2JRRmK2N6Esh+vzQ+CpwWGcPkqHpmil\n/eKf/wQSPCkXChkF39jGZePHK25qXL5gwIdfFzBu9l4PrN6fncVfXv9++uye\ntK2dLTv0RBTaOzswStJnWkExd6/+lPOxLPc5UfU+pWRL7A+rUPA5eMbVIqlT\nhwxX2Yu9TNieWo2CJnaa6DVra2dqFUH0wjFUoREaXEKx+sLm34V/Y4M9MZnX\nIikc\r\n=1uQR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGx6pl/fA4I8eYCuJ7M4h4rHCFM9acFmti9oKCRhsR69AiBl9su2/18XF1XX5FVEire8ECTBlbHRC/If2SA4euRq5g=="}]},"maintainers":[{"name":"timkinnane","email":"timkinnane@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rocket-bot_0.1.2_1555851773637_0.8665351475930787"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-27T11:44:31.781Z","0.1.0":"2019-02-27T11:44:32.101Z","modified":"2022-04-04T13:44:20.404Z","0.1.1":"2019-03-06T12:57:13.509Z","0.1.2":"2019-04-21T13:02:53.771Z"},"maintainers":[{"name":"timkinnane","email":"timkinnane@gmail.com"}],"description":"Consume Rocket.Chat message streams and automate method calls.","homepage":"https://github.com/Amazebot/rocket-control/tree/master/packages/bot","keywords":["rocket.chat","chat","chatops","messaging","CUI","typescript","chatbot"],"repository":{"type":"git","url":"git+ssh://git@github.com/Amazebot/rocket-control.git"},"author":{"name":"Tim Kinnane","email":"tim.kinnane@amazebot.chat"},"license":"MIT","readme":"[control]: https://github.com/Amazebot/rocket-control\n[socket]: https://github.com/Amazebot/rocket-socket\n[lru]: https://www.npmjs.com/package/lru-cache\n\n# 🤖 Rocket Bot\nConsume Rocket.Chat message streams and automate method calls.\n\n---\n\n### Usage\n\nFull use-case examples are on the todo list. See below for method usage.\n\n### Config\n\nSee the main [`rocket-control` README][control] for general configuration.\n\nSpecific configs for this module are as follows (none are required):\n\n| Env var                | Description                                         |\n| ---------------------- | ----------------------------------------------------|\n| `RC_INTEGRATION_ID`    | Applies `message.bot.i` to identify sent messages   |\n| `RC_JOIN`              | CSV of room names or IDs to join on login           |\n| `RC_STREAM_NAME`       | Stream name to subscribe to for messages            |\n| `RC_STREAM_ROOM`       | Room or collection for subscription parameters      |\n| `RC_IGNORE_DIRECT`     | Filter direct messages out of aggregated stream     |\n| `RC_IGNORE_LIVECHAT`   | Filter livechat messages out of aggregated stream   |\n| `RC_IGNORE_EDITED`     | Filter edited messages out of aggregated stream     |\n\n### Driver\n\nProvides a high level interface for connection, login and subscribing to message\nstreams in Rocket.Chat. The default driver instance can be required for general\nusage, to subscribe and respond to the aggregated message stream for a bot user.\n\n```js\nconst { driver } = require('@amazebot/rocket-bot')\n```\n\nOr use the `Driver` class to create multiple driver instances if you need to\nconnect to different sources, streams or isolate cached method results.\n\n#### `new Driver()`\n\nCreate a driver instance. It exposes the lower level `socket` and `api`\ndependencies as properties to allow more advanced usage.\n\n```js\nconst { Driver } = require('@amazebot/rocket-bot')\nconst driver = new Driver()\n```\n\n#### `.login(credentials)`\n\nProxy for [Socket login method](https://github.com/Amazebot/rocket-control/tree/master/packages/socket#logincredentials-and-logout)\n\nBy default uses credentials in `RC_USERNAME` and `RC_PASSWORD` env vars or\n_package.json_: `{ \"rcConfig\": { \"username\": \"bot\", \"password\": \"pass\" } }`\n\n```js\ndriver.login().then(() => console.log('🚀🤖 Logged in!'))\n```\n\nCredentials can also be given at run-time.\n\n```js\ndriver.login({ username: 'me', password: 'pass' }).then(() => console.log('👍'))\n```\n\n#### `.onMessage(callback, options)`\n\nCall a callback on every event in the user's aggregated message stream. The\ncallback arguments use error-first pattern, followed by the message and meta\nobject.\n\n```js\ndriver.onMessage((err, message, meta) => {\n  if (!err) console.log({ message, meta })\n})\n```\n\nA second argument can be given to override config for ignored messages. e.g.\n\n```js\nconst callback = (err, message, meta) => console.log(err || message)\ndriver.onMessage(callback, {\n  edited: true,\n  livechat: false,\n  direct: false\n}) // 👆 ignores livechat and DMs, fires on edited (regardless of config)\n```\n\n> WARNING: The meta field in streams is unstable, may be deprecated in future.\n> See [Issue #12574](https://github.com/RocketChat/Rocket.Chat/issues/12574) and\n> [PR #12763](https://github.com/RocketChat/Rocket.Chat/pull/12763).\n>\n> Please make use of meta conditional to avoid failures on upcoming Rocket.Chat\n> releases and review any changes to message schema for possible updates to\n> `roomType` and `roomName` attributes.\n\n#### `.subscribe(stream, room)`\n\nLower level method for creating subscription through socket. Can be called\nexplicitly to create any number of streams for specific rooms, but mainly used\nimplicitly by `onMessage` for the main aggregated message stream.\n\nReturned subscription instance includes an `.onEvent` method for adding event\nhandlers and `.unsubscribe` method to cancel the subscription.\n\n#### Helpers and Aliases\n\nA collection of methods provide extra utility for bots that are not yet\ndocumented other than in source. Some simply alias socket methods. See the\n[socket][socket readme] or [the codebase]('./src/driver.ts') for description\nand usage of the following:\n\n- `asyncCall`\n- `cacheCall`\n- `callMethod`\n- `userById`\n- `getRoomId`\n- `getRoomName`\n- `getDirectMessageRoomId`\n- `joinRoom`\n- `leaveRoom`\n- `joinRooms`\n- `leaveRooms`\n- `prepareMessage`\n- `sendMessage`\n- `sendToRoomId`\n- `sendToRoom`\n- `sendDirectToUser`\n- `editMessage`\n- `setReaction`\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/Amazebot/rocket-control/issues"}}