Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 = {};
'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);