Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lemmmy/rocketchat-bot
Bot framework for rocket.chat
https://github.com/lemmmy/rocketchat-bot
bot bot-framework rocketchat
Last synced: 4 months ago
JSON representation
Bot framework for rocket.chat
- Host: GitHub
- URL: https://github.com/lemmmy/rocketchat-bot
- Owner: Lemmmy
- License: bsd-3-clause
- Archived: true
- Created: 2017-08-03T21:02:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-04T01:29:06.000Z (over 7 years ago)
- Last Synced: 2024-04-23T23:15:09.401Z (9 months ago)
- Topics: bot, bot-framework, rocketchat
- Language: JavaScript
- Size: 13.7 KB
- Stars: 10
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rocketchat-bot
A bot framework for [Rocket.Chat](https://rocket.chat), built on [bot-commander](https://www.npmjs.com/package/bot-commander).
## Usage
Load the bot like so:
```javascript
const Bot = require("rocketchat-bot").Bot;const bot = new Bot({
server: "your.rocket.chat",
username: "botuser",
password: "botpass"
});bot.start();
bot.on("ready", () => {
bot.loadPlugins(__dirname + "/plugins");
});
```Create a `plugins` directory, containing your named plugins (e.g. `test`, `droll`).
Then create a `plugin.js` file in the directory:```javascript
module.exports = bot => {
bot.command("test")
.action(meta => {
bot.send(meta, "Hello, world!");
});
};
```For more information on the `bot` object, see the [bot-commander](https://www.npmjs.com/package/bot-commander) documentation.
The WebSocket and REST APIs are exposed via bot.wsAPI and bot.webAPI respectively.