Comparing version 1.0.5 to 1.0.6
'use strict'; | ||
var request = require('request'); | ||
var WebSocket = require('ws'); | ||
var EventEmitter = require('events'); | ||
var _ = require('lodash'); | ||
var debug = require('debug')('tinybot'); | ||
var id = 0; | ||
@@ -240,3 +239,3 @@ | ||
var value = matcher[field]; | ||
var actual = message[field]; | ||
var actual = _.get(message, field); | ||
if( field == 'filename' ) { actual = message.file && message.file.name; } | ||
@@ -243,0 +242,0 @@ if( field == 'user' && value[0] != 'U' ) { value = self.userIdForName(value); } |
{ | ||
"name": "tinybot", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A tiny wrapper around the Slack RTM API that provides methods to listen for and send slack messages.", | ||
@@ -32,2 +32,3 @@ "main": "index.js", | ||
"debug": "^2.2.0", | ||
"lodash": "^4.16.1", | ||
"request": "^2.75.0", | ||
@@ -34,0 +35,0 @@ "ws": "^1.1.1" |
@@ -60,5 +60,5 @@ # tinybot | ||
// trolls anyone who posts in #random from an iPhone with nested matchers | ||
bot.hears({channel: '#random', file: { name: 'Slack for iOS'}, function fooBar(message) { | ||
bot.hears({channel: '#random', "file.name": /Slack for iOS/}, function fooBar(message) { | ||
bot.say("ooooh, fancy", '#random'); | ||
}}) | ||
}) | ||
@@ -65,0 +65,0 @@ // snooze one meeting with hearsOnce |
@@ -40,3 +40,3 @@ var expect = require('expect'); | ||
if( err ) { return cb(err); } | ||
bot = new Tinybot(slackToken, null, 'http://localhost:6969'); | ||
bot = new Tinybot(slackToken, '#general', 'http://localhost:6969'); | ||
bot.start(cb); | ||
@@ -109,2 +109,21 @@ }); | ||
it("expands nested fields", function (cb) { | ||
bot.hears({"file.name": 'Slack for iOS'}, function(message) { | ||
bot.say("ooooh, fancy"); | ||
}) | ||
var conversation = [ | ||
{ | ||
file: { | ||
name: 'Slack for iOS' | ||
} | ||
}, | ||
{ | ||
response: 'ooooh, fancy' | ||
} | ||
] | ||
slackTest.expectConversation(conversation, cb); | ||
}); | ||
describe('drop', function() { | ||
@@ -111,0 +130,0 @@ it('allows dropping by function name', function(cb) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17217
396
4
+ Addedlodash@^4.16.1
+ Addedlodash@4.17.21(transitive)