How to use the hubot/es2015.Adapter function in hubot

To help you get started, we’ve selected a few hubot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mtsmfm / hubot-test-helper / src / index.js View on Github external
if (roomName == this.adapter.name) {
      this.adapter.messages.push(['hubot', str]);
    } else {
      if (!(roomName in this.messagesTo)) {
        this.messagesTo[roomName] = [];
      }
      this.messagesTo[roomName].push(['hubot', str]);
    }
  }

  loadAdapter() {
    this.adapter = new Room(this);
  }
}

class Room extends Hubot.Adapter {
  // XXX: https://github.com/hubotio/hubot/pull/1390
  static messages(obj) {
    if (obj instanceof MockRobot) {
      return obj.adapter.messages;
    } else {
      return obj.messages;
    }
  }

  constructor(robot) {
    super();
    this.robot = robot;
    this.messages = [];

    this.privateMessages = {};
github hubotio / hubot-mock-adapter / index.js View on Github external
'use strict';

const Adapter = require('hubot/es2015').Adapter;

class MockAdapter extends Adapter {
  send (envelope/* , ...strings */) {
    const strings = [].slice.call(arguments, 1);
    this.emit('send', envelope, strings);
  }
  reply (envelope/* , ...strings */) {
    const strings = [].slice.call(arguments, 1);
    this.emit('reply', envelope, strings);
  }
  topic (envelope/* , ...strings */) {
    const strings = [].slice.call(arguments, 1);
    this.emit('topic', envelope, strings);
  }
  play (envelope/* , ...strings */) {
    const strings = [].slice.call(arguments, 1);