Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    rocketchat-botpublic

    rocketchat-bot

    A bot framework for Rocket.Chat, built on bot-commander.

    Usage

    Load the bot like so:

    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:

    module.exports = bot => {
      bot.command("test")
        .action(meta => {
          bot.send(meta, "Hello, world!");
        });
    };

    For more information on the bot object, see the bot-commander documentation.

    The WebSocket and REST APIs are exposed via bot.wsAPI and bot.webAPI respectively.

    install

    npm i rocketchat-bot

    Downloadsweekly downloads

    2

    version

    1.0.1

    license

    BSD-3-Clause

    repository

    githubgithub

    last publish

    collaborators

    • avatar