slack-ruby-bot 0.11.2 → 0.12.0
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/CHANGELOG.md +10 -6
- data/README.md +4 -4
- data/UPGRADING.md +6 -0
- data/lib/slack-ruby-bot/server.rb +0 -24
- data/lib/slack-ruby-bot/version.rb +1 -1
- data/slack-ruby-bot.gemspec +1 -1
- data/spec/slack-ruby-bot/server_spec.rb +0 -17
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22dc3beb892b34e2ac402dda4e3406b06ad7b60d25c6db1098517934f599a000
|
4
|
+
data.tar.gz: 8d089bd14bf6a096a89711627f459504bc3ba6a1dc04d1c45eff4c40476cf8ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff99ab182faab024601afe41a40fa8b66c589aeaf66d02819ad05196200e4ef3d6cd7e5fae6c670630f3b7225d96fc33d0031e370852b3ba6bdd33acfc182a22
|
7
|
+
data.tar.gz: dd313bbae823189799d92888222f9433a6cba629aba7ac7e922dfd7154317c3332ad1ff1246a6537ec2000626826866bb4ebcf2fb857aac614609cedcd6ba0b2
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
-
### 0.
|
1
|
+
### 0.12.0 (2019/2/25)
|
2
|
+
|
3
|
+
* [#203](https://github.com/slack-ruby/slack-ruby-bot/pull/203): Removing restart logic - [@RodneyU215](https://github.com/RodneyU215).
|
4
|
+
|
5
|
+
### 0.11.2 (2018/12/1)
|
2
6
|
|
3
7
|
* [#198](https://github.com/slack-ruby/slack-ruby-bot/pull/198): Recommend using `async-websocket` instead of `celluloid-io` - [@dblock](https://github.com/dblock).
|
4
8
|
* [#202](https://github.com/slack-ruby/slack-ruby-bot/pull/202): Allow frozen string in Hooks::Message - [@jonosenior](https://github.com/jonosenior).
|
5
9
|
|
6
|
-
### 0.11.1 (2018/
|
10
|
+
### 0.11.1 (2018/5/6)
|
7
11
|
|
8
12
|
* [#187](https://github.com/slack-ruby/slack-ruby-bot/pull/187): Added support for the [official Giphy SDK](https://github.com/Giphy/giphy-ruby-client) - [@dblock](https://github.com/dblock).
|
9
13
|
* [#185](https://github.com/slack-ruby/slack-ruby-bot/pull/185): Log backtrace of exceptions - [@dblock](https://github.com/dblock).
|
10
14
|
|
11
|
-
### 0.11.0 (2018/
|
15
|
+
### 0.11.0 (2018/4/2)
|
12
16
|
|
13
17
|
* [#182](https://github.com/slack-ruby/slack-ruby-bot/pull/182): Refactor CommandsHelper class and Help module - [@mdudzinski](https://github.com/mdudzinski).
|
14
18
|
* [#180](https://github.com/slack-ruby/slack-ruby-bot/pull/180): Allow to respond to text in attachments #177 - [@mdudzinski](https://github.com/mdudzinski).
|
@@ -24,18 +28,18 @@
|
|
24
28
|
* [#163](https://github.com/slack-ruby/slack-ruby-bot/pull/163): Allow `command` to accept regular expressions - [@kstole](https://github.com/kstole).
|
25
29
|
* [#166](https://github.com/slack-ruby/slack-ruby-bot/pull/166): Allow special characters and capitals in bot aliases - [@kstole](https://github.com/kstole).
|
26
30
|
|
27
|
-
### 0.10.4 (2017/
|
31
|
+
### 0.10.4 (2017/7/5)
|
28
32
|
|
29
33
|
* [#149](https://github.com/slack-ruby/slack-ruby-bot/pull/149): Add `logger` configuration to set a custom logger - [@upscent](https://github.com/upscent).
|
30
34
|
* [#147](https://github.com/slack-ruby/slack-ruby-bot/pull/147): Adds `server.on` as a shortcut for `hooks.add` and deprecate `hooks` method - [@laertispappas](https://github.com/laertispappas).
|
31
35
|
* [#143](https://github.com/slack-ruby/slack-ruby-bot/pull/143): Provide `permitted?` method to allow for simple authorization extensions - [@chuckremes](https://github.com/chuckremes).
|
32
36
|
|
33
|
-
### 0.10.3 (2017/
|
37
|
+
### 0.10.3 (2017/6/15)
|
34
38
|
|
35
39
|
* [#145](https://github.com/slack-ruby/slack-ruby-bot/pull/145): Map multiple command strings to same controller method - [@chuckremes](https://github.com/chuckremes).
|
36
40
|
* [#144](https://github.com/slack-ruby/slack-ruby-bot/pull/144): Support usage of commands with embedded spaces when using Controller methods - [@chuckremes](https://github.com/chuckremes).
|
37
41
|
|
38
|
-
### 0.10.2 (2017/
|
42
|
+
### 0.10.2 (2017/6/3)
|
39
43
|
|
40
44
|
* [#137](https://github.com/slack-ruby/slack-ruby-bot/pull/137): Add Model-View-Controller classes to allow for more explicit control over how `command`s are designed - [@chuckremes](https://github.com/chuckremes).
|
41
45
|
* [#130](https://github.com/slack-ruby/slack-ruby-bot/issues/130): Added test dependencies in TUTORIAL.md - [@jbristow](https://github.com/jbristow).
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ If you are not familiar with Slack bots or Slack API concepts, you might want to
|
|
19
19
|
|
20
20
|
## Stable Release
|
21
21
|
|
22
|
-
You're reading the documentation for the **stable** release of slack-ruby-bot, v0.
|
22
|
+
You're reading the documentation for the **stable** release of slack-ruby-bot, v0.12.0.
|
23
23
|
See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING.md) for how to upgrade to more recent versions.
|
24
24
|
|
25
25
|
## Usage
|
@@ -32,7 +32,7 @@ See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING
|
|
32
32
|
source 'https://rubygems.org'
|
33
33
|
|
34
34
|
gem 'slack-ruby-bot'
|
35
|
-
gem '
|
35
|
+
gem 'async-websocket'
|
36
36
|
```
|
37
37
|
|
38
38
|
#### pongbot.rb
|
@@ -83,7 +83,7 @@ end
|
|
83
83
|
|
84
84
|
Command match data includes `match['bot']`, `match['command']` and `match['expression']`. The `bot` match always checks against the `SlackRubyBot::Config.user` and `SlackRubyBot::Config.user_id` values obtained when the bot starts.
|
85
85
|
|
86
|
-
The `command` method can take strings, which will have be escaped with `Regexp.escape`, and regular expressions.
|
86
|
+
The `command` method can take strings, which will have to be escaped with `Regexp.escape`, and regular expressions.
|
87
87
|
|
88
88
|
```ruby
|
89
89
|
class CallBot < SlackRubyBot::Bot
|
@@ -145,7 +145,7 @@ This is particularly fun with emoji.
|
|
145
145
|
|
146
146
|

|
147
147
|
|
148
|
-
Bots also
|
148
|
+
Bots will also respond to a direct message, with or without the bot name in the message itself.
|
149
149
|
|
150
150
|

|
151
151
|
|
data/UPGRADING.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Upgrading SlackRubyBot
|
2
2
|
======================
|
3
3
|
|
4
|
+
### Upgrading to >= 0.12.0
|
5
|
+
|
6
|
+
#### Remove any references to `SlackRubyBot::Server#restart!`
|
7
|
+
|
8
|
+
We have removed `SlackRubyBot::Server#restart!` since the [`slack-ruby-client`](https://github.com/slack-ruby/slack-ruby-client/blob/master/CHANGELOG.md) now restarts any connection that was not intentionally stopped via `SlackRubyBot::Server#stop!`.
|
9
|
+
|
4
10
|
### Upgrading to >= 0.10.4
|
5
11
|
|
6
12
|
#### Replace `server.hooks.add` with `server.on`
|
@@ -32,37 +32,17 @@ module SlackRubyBot
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def start!
|
35
|
-
@stopping = false
|
36
|
-
@async = false
|
37
35
|
client.start!
|
38
36
|
end
|
39
37
|
|
40
38
|
def start_async
|
41
|
-
@stopping = false
|
42
|
-
@async = true
|
43
39
|
client.start_async
|
44
40
|
end
|
45
41
|
|
46
42
|
def stop!
|
47
|
-
@stopping = true
|
48
43
|
client.stop! if @client
|
49
44
|
end
|
50
45
|
|
51
|
-
def restart!(wait = 1)
|
52
|
-
@async ? start_async : start!
|
53
|
-
rescue StandardError => e
|
54
|
-
case e.message
|
55
|
-
when 'account_inactive', 'invalid_auth'
|
56
|
-
logger.error "#{token}: #{e.message}, team will be deactivated."
|
57
|
-
@stopping = true
|
58
|
-
else
|
59
|
-
sleep wait
|
60
|
-
logger.error "#{e.message}, reconnecting in #{wait} second(s)."
|
61
|
-
logger.debug e
|
62
|
-
restart! [wait * 2, 60].min
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
46
|
private
|
67
47
|
|
68
48
|
def handle_exceptions
|
@@ -98,10 +78,6 @@ module SlackRubyBot
|
|
98
78
|
def client
|
99
79
|
@client ||= begin
|
100
80
|
client = SlackRubyBot::Client.new(aliases: aliases, send_gifs: send_gifs, token: token)
|
101
|
-
client.on :close do |_data|
|
102
|
-
@client = nil
|
103
|
-
restart! unless @stopping
|
104
|
-
end
|
105
81
|
_hooks.client = client
|
106
82
|
|
107
83
|
client
|
data/slack-ruby-bot.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.licenses = ['MIT']
|
16
16
|
s.summary = 'The easiest way to write a Slack bot in Ruby.'
|
17
17
|
s.add_dependency 'hashie'
|
18
|
-
s.add_dependency 'slack-ruby-client', '>= 0.
|
18
|
+
s.add_dependency 'slack-ruby-client', '>= 0.14.0'
|
19
19
|
s.add_development_dependency 'rack-test'
|
20
20
|
s.add_development_dependency 'rake'
|
21
21
|
s.add_development_dependency 'rspec'
|
@@ -94,21 +94,4 @@ describe SlackRubyBot::Server do
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
97
|
-
context '#restart!' do
|
98
|
-
subject do
|
99
|
-
SlackRubyBot::Server.new(token: 'token')
|
100
|
-
end
|
101
|
-
it 'reloads server after disconnection' do
|
102
|
-
expect(subject).to receive(:restart!)
|
103
|
-
subject.send(:client).send(:callbacks)['close'].first.call
|
104
|
-
expect(subject.instance_variable_get(:@stopping)).to be_falsy
|
105
|
-
end
|
106
|
-
it 'does not reload server for inactive account' do
|
107
|
-
stopping = -> { subject.instance_variable_get :@stopping }
|
108
|
-
allow(subject).to receive(:start!) { raise StandardError, 'account_inactive' }
|
109
|
-
expect(stopping.call).to be_falsy
|
110
|
-
subject.restart!
|
111
|
-
expect(stopping.call).to be true
|
112
|
-
end
|
113
|
-
end
|
114
97
|
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.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.14.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.14.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rack-test
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|