slack-ruby-bot 0.5.2 → 0.5.3

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: 798363fd87ec36b9a8e488f9e19f1c327e247056
4
- data.tar.gz: 2cbd2241442997ef069af02f665b673d8e946696
3
+ metadata.gz: ff5cb3cefc95c4a84d5cbe3e99f5975496d9cdf5
4
+ data.tar.gz: a74bb7b70b4c750b12a038658ee88c8f3890b7dc
5
5
  SHA512:
6
- metadata.gz: aaf11fa6bbc8f93ccb702fade2c9b49c28d90dde8e60db35e00bb17e3318ce7174d9033f2a9cc7794ca6f21a7aa03c820ad26ede18d583db6b43759df1475f28
7
- data.tar.gz: a234a8651084ee3d140f1876adefcf30465cc2ba285bc7b81969fa42ecce1bca2c1828724bc3dbeb2f92cc4d5c26e340ce70645ad6de1aeaa4cf84b28fee664b
6
+ metadata.gz: 801999251e958c05df6f87fe890d03a16e4412e2dfd68e1fc1bde87ab03426ba86057ab20aeb8859b7717aeb484940cb477296ee04de04d2a05c76cad280a442
7
+ data.tar.gz: 58cee5862ee3f9879e1f5a04af69a9558eba67c81a444a9e8348372a08c4ff340f945614fd1e5a5a816dcfdc8ad83a3b017a66f9fc3d85ed53608c9ab4df3db3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.5.3 (12/28/2015)
2
+
3
+ * [#36](https://github.com/dblock/slack-ruby-bot/issues/36): Fix: non-English bot aliases now work - [@dblock](https://github.com/dblock).
4
+
1
5
  ### 0.5.2 (12/26/2015)
2
6
 
3
7
  * Enable setting bot aliases per instance of `SlackRubyBot::Server` - [@dblock](https://github.com/dblock).
data/README.md CHANGED
@@ -17,7 +17,7 @@ A generic Slack bot framework written in Ruby on top of [slack-ruby-client](http
17
17
 
18
18
  ## Stable Release
19
19
 
20
- You're reading the documentation for the **stable** release of slack-ruby-bot, 0.5.2.
20
+ You're reading the documentation for the stable release of slack-ruby-bot, 0.5.3.
21
21
 
22
22
  ## Usage
23
23
 
@@ -227,6 +227,24 @@ SlackRubyBot.configure do |config|
227
227
  end
228
228
  ```
229
229
 
230
+ ### Advanced Integration
231
+
232
+ You may want to integrate a bot or multiple bots into other systems, in which case a globally configured bot may not work for you. You may create instances of [SlackRubyBot::Server](lib/slack-ruby-bot/server.rb) which accepts `token` and `aliases`.
233
+
234
+ ```ruby
235
+ EM.run do
236
+ bot1 = SlackRubyBot::Server.new(token: token1, aliases: ['bot1'])
237
+ bot1.auth!
238
+ bot1.start_async
239
+
240
+ bot2 = SlackRubyBot::Server.new(token: token2, aliases: ['bot2'])
241
+ bot2.auth!
242
+ bot2.start_async
243
+ end
244
+ ```
245
+
246
+ For an example of advanced integration that supports multiple teams, see [slack-gamebot](https://github.com/dblock/slack-gamebot) and [playplay.io](http://playplay.io) that is built on top of it.
247
+
230
248
  ### RSpec Shared Behaviors
231
249
 
232
250
  Slack-ruby-bot ships with a number of shared RSpec behaviors that can be used in your RSpec tests. Require 'slack-ruby-bot/rspec' in your `spec_helper.rb`.
@@ -2,7 +2,7 @@ module SlackRubyBot
2
2
  module Commands
3
3
  class Default < Base
4
4
  command 'about'
5
- match(/^(?<bot>[\w[:punct:]@<>]*)$/)
5
+ match(/^(?<bot>[[:alnum:][:punct:]@<>]*)$/u)
6
6
 
7
7
  def self.call(client, data, _match)
8
8
  send_message_with_gif client, data.channel, SlackRubyBot::ABOUT, 'selfie'
@@ -48,8 +48,8 @@ module SlackRubyBot
48
48
  def self.command(*values, &block)
49
49
  values.each do |value|
50
50
  escaped = Regexp.escape(value)
51
- match Regexp.new("^(?<bot>[\\w[:punct:]@<>]*)[\\s]+(?<command>#{escaped})$", Regexp::IGNORECASE), &block
52
- match Regexp.new("^(?<bot>[\\w[:punct:]@<>]*)[\\s]+(?<command>#{escaped})[\\s]+(?<expression>.*)$", Regexp::IGNORECASE), &block
51
+ match Regexp.new("^(?<bot>[[:alnum:][:punct:]@<>]*)[\\s]+(?<command>#{escaped})$", Regexp::IGNORECASE), &block
52
+ match Regexp.new("^(?<bot>[[:alnum:][:punct:]@<>]*)[\\s]+(?<command>#{escaped})[\\s]+(?<expression>.*)$", Regexp::IGNORECASE), &block
53
53
  end
54
54
  end
55
55
 
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBot
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
3
3
  end
@@ -5,7 +5,7 @@ describe SlackRubyBot do
5
5
  SlackRubyBot::App.new
6
6
  end
7
7
  before do
8
- ENV['SLACK_RUBY_BOT_ALIASES'] = ':emoji: alias'
8
+ ENV['SLACK_RUBY_BOT_ALIASES'] = ':emoji: alias каспаров'
9
9
  end
10
10
  after do
11
11
  ENV.delete('SLACK_RUBY_BOT_ALIASES')
@@ -16,4 +16,7 @@ describe SlackRubyBot do
16
16
  it 'responds to an alias' do
17
17
  expect(message: 'alias hi').to respond_with_slack_message('Hi <@user>!')
18
18
  end
19
+ it 'responds to a non-English alias' do
20
+ expect(message: 'каспаров hi').to respond_with_slack_message('Hi <@user>!')
21
+ end
19
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-26 00:00:00.000000000 Z
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie