slackbotsy 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/slackbotsy/bot.rb +6 -1
- data/lib/slackbotsy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ec8e606f409b90614e9919d98281ecd3d0201c9
|
4
|
+
data.tar.gz: ac463292ad660a4299d29e8c01081e871897ad52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044072463462a5d5933abe0f33e7471a73e85774750579df1d44028cbc4bf7a7ecee113002ca2b8fd1ea88b62f51a9ab30381a01930900a8910d3a480825c592
|
7
|
+
data.tar.gz: df970d1c61fb5b57e99d60ce8143cc84f445c36b7e27ae0aeb32f53a704ddec1124960b1a866e7babb40476824d5377cf6ae4edc6d3b1fbc7cc7e85ef952e31e
|
data/lib/slackbotsy/bot.rb
CHANGED
@@ -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
|
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
|
|
data/lib/slackbotsy/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|