slack-bot-server 0.4.6 → 0.4.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6685270303a7d38f8c8b833048eec1a68c17680
4
- data.tar.gz: 48e3b42af56269b7f9eba8acb397902a8e780bc8
3
+ metadata.gz: 409222fb9d1da1ef4b382ea3b500b56a0cd40b92
4
+ data.tar.gz: 07bc768fad2c7667eb492093ba428593b0e04f1c
5
5
  SHA512:
6
- metadata.gz: 3efef59a7ef8be23ac6eece069f26d90f6f287b5049cf8e8d4ef4aee867e03ba2f3d461913a26c6b8d61b5a14c024c64b3f26303b1ae2a30cd5ce2cd17b377bf
7
- data.tar.gz: edc37497ad3846105145918a74c9d507beb262c2105a7de03fe60f608102cfb76faf0010f01e1ccc8513ac3f6fb1a92f270bb16d856f13da8c782e9751dad58b
6
+ metadata.gz: 1bf66dc577ec2da21eb1446a6c6a99d076b604e2fa6695e458f527df3a8de5671953dc315e241d32faa6a63925d55b16abedbdec88d94c4ee83c4b6592c3a220
7
+ data.tar.gz: e7577836ba2f99695b76e1a195bbcc607d986882fb8a7a52a314c0dfa2c6ea10f5a3e4d1c47d909d4f4c6b71f935bd243ba4694fba1a2ae7a4163fbb86435a85
@@ -2,4 +2,5 @@ language: ruby
2
2
  rvm:
3
3
  - 2.1
4
4
  - 2.2
5
+ - 2.3.0
5
6
  before_install: gem install bundler
@@ -1,5 +1,12 @@
1
1
  ## Unreleased
2
2
 
3
+
4
+ ## 0.4.7
5
+
6
+ ### Fixed
7
+ - Bots added using numeric keys now work
8
+ - Bots added before the server starts which raise errors when started should not longer take the server down
9
+
3
10
  ## 0.4.6
4
11
 
5
12
  ### Added
data/README.md CHANGED
@@ -22,6 +22,14 @@ Or install it yourself as:
22
22
 
23
23
  $ gem install slack-bot-server
24
24
 
25
+
26
+ ### Optional queue stores
27
+
28
+ The default queueing mechanism uses Redis as its underlying store, but you are not tied to this - any object that has the API `#push`, `#pop` and `#clear` can be used -- and so Redis is not an explicit dependency.
29
+
30
+ However, if you are happy to use Redis (as the examples below to), you shouldensure to add the `redis` gem to your `Gemfile` or your local rubygems installation.
31
+
32
+
25
33
  ## Usage
26
34
 
27
35
  To use the server in your application, you'll need to create a short script that sets up your integration and then runs the server process. Here's a simple example:
@@ -160,6 +168,17 @@ of other hooks that you can use when writing a bot:
160
168
  the bot was accidentally/intermittently disconnected via the `running?`
161
169
  method, which will return true unless the bot was explicitly stopped.
162
170
 
171
+ ### Slack App setup
172
+
173
+ When you create your Slack App configuration at https://api.slack.com, it is
174
+ recommended that you include _at least_ the following scopes:
175
+
176
+ * `identify`
177
+ * `bot`
178
+ * `chat:write:bot`
179
+
180
+ Depending on what your own app plans to do, of course, you may need other scopes
181
+ too.
163
182
 
164
183
  ### Managing bots
165
184
 
@@ -170,6 +189,8 @@ control to add the token to the server.
170
189
 
171
190
  ```ruby
172
191
  # Somewhere within your application
192
+ require 'slack_bot_server/remote_control'
193
+
173
194
  queue = SlackBotServer::RedisQueue.new(redis: Redis.new)
174
195
  slack_remote = SlackBotServer::RemoteControl.new(queue: queue)
175
196
  slack_remote.add_bot('user-accounts-slack-api-token')
@@ -192,7 +213,7 @@ Up to this point, your bots could only respond to mentions and IM messages, but
192
213
  We can tell a bot to send a message into its default room fairly simply using the remote:
193
214
 
194
215
  ```ruby
195
- slack_remote.say('bot-key', text: 'I have an important announcement to make!')
216
+ slack_remote.say('bot-key', channel: '#general', text: 'I have an important announcement to make!')
196
217
  ```
197
218
 
198
219
  ## Development
@@ -209,4 +230,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/exciti
209
230
  ## License
210
231
 
211
232
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
212
-
@@ -0,0 +1,2 @@
1
+ # Shim so that bundler can require the code based only on the gem name
2
+ require 'slack_bot_server'
@@ -79,7 +79,13 @@ class SlackBotServer::Server
79
79
  def start
80
80
  EM.run do
81
81
  @running = true
82
- @bots.each { |key, bot| bot.start }
82
+ @bots.each do |key, bot|
83
+ begin
84
+ bot.start
85
+ rescue => e
86
+ log_error(e)
87
+ end
88
+ end
83
89
  listen_for_instructions if queue
84
90
  end
85
91
  end
@@ -93,7 +99,7 @@ class SlackBotServer::Server
93
99
  # @param key [String] the key of the bot we're looking for
94
100
  # @return Bot
95
101
  def bot(key)
96
- @bots[key.to_sym]
102
+ @bots[key]
97
103
  end
98
104
 
99
105
  # Adds a bot to this server
@@ -104,7 +110,7 @@ class SlackBotServer::Server
104
110
  bot = @add_proc.call(*args)
105
111
  if bot.respond_to?(:start) && !bot(bot.key)
106
112
  log "adding bot #{bot}"
107
- @bots[bot.key.to_sym] = bot
113
+ @bots[bot.key] = bot
108
114
  bot.start if @running
109
115
  end
110
116
  rescue => e
@@ -117,7 +123,7 @@ class SlackBotServer::Server
117
123
  def remove_bot(key)
118
124
  if (bot = bot(key))
119
125
  bot.stop
120
- @bots.delete(key.to_sym)
126
+ @bots.delete(key)
121
127
  end
122
128
  rescue => e
123
129
  log_error(e)
@@ -1,4 +1,4 @@
1
1
  module SlackBotServer
2
2
  # The current version of the +SlackBotServer+ framework
3
- VERSION = "0.4.6"
3
+ VERSION = "0.4.7"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-bot-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Adam
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slack-ruby-client
@@ -153,6 +153,7 @@ files:
153
153
  - LICENSE.txt
154
154
  - README.md
155
155
  - Rakefile
156
+ - lib/slack-bot-server.rb
156
157
  - lib/slack_bot_server.rb
157
158
  - lib/slack_bot_server/bot.rb
158
159
  - lib/slack_bot_server/local_queue.rb
@@ -183,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
184
  version: '0'
184
185
  requirements: []
185
186
  rubyforge_project:
186
- rubygems_version: 2.5.1
187
+ rubygems_version: 2.2.2
187
188
  signing_key:
188
189
  specification_version: 4
189
190
  summary: A server for hosting slack bots.