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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +19 -1
- data/lib/slack-ruby-bot/commands/about.rb +1 -1
- data/lib/slack-ruby-bot/commands/base.rb +2 -2
- data/lib/slack-ruby-bot/version.rb +1 -1
- data/spec/slack-ruby-bot/commands/aliases_spec.rb +4 -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: ff5cb3cefc95c4a84d5cbe3e99f5975496d9cdf5
|
4
|
+
data.tar.gz: a74bb7b70b4c750b12a038658ee88c8f3890b7dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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>[
|
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>[
|
52
|
-
match Regexp.new("^(?<bot>[
|
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
|
|
@@ -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.
|
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-
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|