slackbotsy 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff4258d81c83773fd3ad6a89429066f0fd5f9d40
4
- data.tar.gz: 04e198a2f4a19d6bd71d386cded6cd8848cca672
3
+ metadata.gz: 7ec8e606f409b90614e9919d98281ecd3d0201c9
4
+ data.tar.gz: ac463292ad660a4299d29e8c01081e871897ad52
5
5
  SHA512:
6
- metadata.gz: 50daa72fc1b30f103486b71bea2a9d3511214efbf520c31862fd13029bdefdf9c9626d5d208ca10f2ed08c026cb85c11eca9dc632f8f2337c83c24417753cbdf
7
- data.tar.gz: 116a21b432e897fe5da63022785aba10d10cd07c787da80b98ad7f217e11ff51788ebea0ab0a3b35e64ed95d3120eaba5d493e3fc82fc399beb0b8f39aba4457
6
+ metadata.gz: 044072463462a5d5933abe0f33e7471a73e85774750579df1d44028cbc4bf7a7ecee113002ca2b8fd1ea88b62f51a9ab30381a01930900a8910d3a480825c592
7
+ data.tar.gz: df970d1c61fb5b57e99d60ce8143cc84f445c36b7e27ae0aeb32f53a704ddec1124960b1a866e7babb40476824d5377cf6ae4edc6d3b1fbc7cc7e85ef952e31e
@@ -2,6 +2,7 @@ require 'net/http'
2
2
  require 'net/https'
3
3
  require 'uri'
4
4
  require 'json'
5
+ require 'set'
5
6
 
6
7
  module Slackbotsy
7
8
 
@@ -9,6 +10,10 @@ module Slackbotsy
9
10
 
10
11
  def initialize(options)
11
12
  @options = options
13
+
14
+ ## use set of tokens for (more or less) O(1) lookup on multiple channels
15
+ @options['outgoing_token'] = Array(@options['outgoing_token']).to_set
16
+
12
17
  @regexes = {}
13
18
  setup_incoming_webhook # http connection for async replies
14
19
  yield if block_given? # run any hear statements in block
@@ -60,7 +65,7 @@ module Slackbotsy
60
65
 
61
66
  ## check message and run blocks for any matches
62
67
  def handle_item(msg)
63
- return nil unless msg[:token] == @options['outgoing_token'] # ensure messages are for us from slack
68
+ return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack
64
69
  return nil if msg[:user_name] == 'slackbot' # do not reply to self
65
70
  return nil unless msg[:text].is_a?(String) # skip empty messages
66
71
 
@@ -1,3 +1,3 @@
1
1
  module Slackbotsy
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackbotsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-08 00:00:00.000000000 Z
11
+ date: 2014-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler