slack-ruby-bot 0.4.2 → 0.4.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: 27ef75b4d9ac822b0386b61c6cb4f868e50ab886
4
- data.tar.gz: 0935126c87fc8d94e6f0040bd5036d4aebbab722
3
+ metadata.gz: c792bd3959ae8c401a12e7f6c584fdae6c6cf144
4
+ data.tar.gz: 2ac80c543a90ea90f3f303cda1ef4c9d2612eafe
5
5
  SHA512:
6
- metadata.gz: be49d4c6780e9c79189b9b8912ab11e4ef480c60aacb43a88b51c4dcfb3dbaedf427a20ec377ec9489c7fa93f995ac49c87560d25100fced8e219c26c5e0c02d
7
- data.tar.gz: f5b292868182f92738cf452310edcab0ddbcb5ac3e4d2f9b1a331e171f56a6d0cca33c3c875d77d6ea01fd124d08159ebd7b531a66c1d24ebc6ef1a8a8449455
6
+ metadata.gz: 9a2464dbe62cffb08e8e3cbddf05180c38678bef1451249bb36fb5be539dff92ccadefa30d92c99ab41d537aceed4c07fd1af6b1ccdae10a32b03932f9768582
7
+ data.tar.gz: fe46f4aba9f1e5ff236447c617493010e8aa2e48133208eb2f8e614ed6143f53a23da63e86ddd54a1e4823790c12620e7d8eb60b5e23aa1072500d2098127866
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 0.4.3 (8/21/2015)
2
+
3
+ * [#13](https://github.com/dblock/slack-ruby-bot/issues/13): You can now address the bot by its Slack @id - [@dblock](https://githubcom/dblock).
4
+
5
+ * Your contribution here.
6
+
1
7
  ### 0.4.2 (8/20/2015)
2
8
 
3
9
  * [#12](https://github.com/dblock/slack-ruby-bot/issues/12): Added support for bot aliases - [@dblock](https://githubcom/dblock).
data/DEPLOYMENT.md CHANGED
@@ -25,7 +25,7 @@ The bot replies with animated GIFs. While it's currently not necessary, you may
25
25
  Optional names for this bot.
26
26
 
27
27
  ```
28
- heroku config:add SLACK_RUBY_BOT_ALIASES=:pong: table-tennis ping-pong
28
+ heroku config:add SLACK_RUBY_BOT_ALIASES=":pong: table-tennis ping-pong"
29
29
  ```
30
30
 
31
31
  ### Heroku Idling
data/README.md CHANGED
@@ -56,7 +56,7 @@ The following examples of production-grade bots based on slack-ruby-bot are list
56
56
 
57
57
  ### Commands and Operators
58
58
 
59
- Bots are addressed by name and respond to commands and operators. By default a command class responds, case-insensitively, to its name. A class called `Phone` that inherits from `SlackRubyBot::Commands::Base` responds to `phone` and `Phone` and calls the `call` method when implemented.
59
+ Bots are addressed by name and respond to commands and operators. By default a command class responds, case-insensitively, to its name and Slack ID. A class called `Phone` that inherits from `SlackRubyBot::Commands::Base` responds to `phone` and `Phone` and calls the `call` method when implemented.
60
60
 
61
61
  ```ruby
62
62
  class Phone < SlackRubyBot::Commands::Base
@@ -107,7 +107,7 @@ Operator match data includes `match['operator']` and `match['expression']`. The
107
107
 
108
108
  ### Bot Aliases
109
109
 
110
- A bot will always respond to its name, but you can specify multiple aliases via the `SLACK_RUBY_BOT_ALIASES` environment variable or via an explicit configuration.
110
+ A bot will always respond to its name and Slack ID, but you can specify multiple aliases via the `SLACK_RUBY_BOT_ALIASES` environment variable or via an explicit configuration.
111
111
 
112
112
  ```
113
113
  SLACK_RUBY_BOT_ALIASES=:pp: table-tennis
@@ -121,7 +121,7 @@ end
121
121
 
122
122
  This is particularly fun with emoji.
123
123
 
124
- ![](screenshots/alias.gif)
124
+ ![](screenshots/aliases.gif)
125
125
 
126
126
  ### Generic Routing
127
127
 
@@ -2,7 +2,7 @@ module SlackRubyBot
2
2
  module Commands
3
3
  class Default < Base
4
4
  command 'about'
5
- match(/^(?<bot>\w*)$/)
5
+ match(/^(?<bot>[\w[:punct:]@<>]*)$/)
6
6
 
7
7
  def self.call(client, data, _match)
8
8
  send_message_with_gif client, data.channel, SlackRubyBot::ABOUT, 'selfie'
@@ -41,8 +41,8 @@ module SlackRubyBot
41
41
 
42
42
  def self.command(*values, &block)
43
43
  values.each do |value|
44
- match Regexp.new("^(?<bot>[\\w[:punct:]]*)[\\s]+(?<command>#{value})$", Regexp::IGNORECASE), &block
45
- match Regexp.new("^(?<bot>[\\w[:punct:]]*)[\\s]+(?<command>#{value})[\\s]+(?<expression>.*)$", Regexp::IGNORECASE), &block
44
+ match Regexp.new("^(?<bot>[\\w[:punct:]@<>]*)[\\s]+(?<command>#{value})$", Regexp::IGNORECASE), &block
45
+ match Regexp.new("^(?<bot>[\\w[:punct:]@<>]*)[\\s]+(?<command>#{value})[\\s]+(?<expression>.*)$", Regexp::IGNORECASE), &block
46
46
  end
47
47
  end
48
48
 
@@ -11,7 +11,7 @@ module SlackRubyBot
11
11
  attr_accessor :team_id
12
12
 
13
13
  def names
14
- [user, aliases].compact.flatten
14
+ [user, aliases, "<@#{user_id.downcase}>", "<@#{user_id.downcase}>:"].compact.flatten
15
15
  end
16
16
 
17
17
  def name?(name)
@@ -3,6 +3,7 @@ RSpec.configure do |config|
3
3
  SlackRubyBot.configure do |c|
4
4
  c.token = 'testtoken'
5
5
  c.user = 'rubybot'
6
+ c.user_id = 'DEADBEEF'
6
7
  end
7
8
  end
8
9
  end
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBot
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3'
3
3
  end
@@ -10,4 +10,7 @@ describe SlackRubyBot::Commands::Default do
10
10
  it 'upcase' do
11
11
  expect(message: SlackRubyBot.config.user.upcase).to respond_with_slack_message(SlackRubyBot::ABOUT)
12
12
  end
13
+ it 'id' do
14
+ expect(message: "<@#{SlackRubyBot.config.user_id}>").to respond_with_slack_message(SlackRubyBot::ABOUT)
15
+ end
13
16
  end
@@ -7,4 +7,10 @@ describe SlackRubyBot::Commands::Hi do
7
7
  it 'says hi' do
8
8
  expect(message: "#{SlackRubyBot.config.user} hi").to respond_with_slack_message('Hi <@user>!')
9
9
  end
10
+ it 'says hi to @bot' do
11
+ expect(message: "<@#{SlackRubyBot.config.user_id}> hi").to respond_with_slack_message('Hi <@user>!')
12
+ end
13
+ it 'says hi to @bot: ' do
14
+ expect(message: "<@#{SlackRubyBot.config.user_id}>: hi").to respond_with_slack_message('Hi <@user>!')
15
+ end
10
16
  end
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.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-08-20 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: slack-ruby-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '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
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: giphy
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.0.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.0.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: websocket-driver
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.5.4
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.5.4
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rack-test
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: vcr
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: webmock
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
@@ -170,11 +170,11 @@ executables: []
170
170
  extensions: []
171
171
  extra_rdoc_files: []
172
172
  files:
173
- - .gitignore
174
- - .rspec
175
- - .rubocop.yml
176
- - .rubocop_todo.yml
177
- - .travis.yml
173
+ - ".gitignore"
174
+ - ".rspec"
175
+ - ".rubocop.yml"
176
+ - ".rubocop_todo.yml"
177
+ - ".travis.yml"
178
178
  - CHANGELOG.md
179
179
  - CONTRIBUTING.md
180
180
  - DEPLOYMENT.md
@@ -251,17 +251,17 @@ require_paths:
251
251
  - lib
252
252
  required_ruby_version: !ruby/object:Gem::Requirement
253
253
  requirements:
254
- - - '>='
254
+ - - ">="
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
257
  required_rubygems_version: !ruby/object:Gem::Requirement
258
258
  requirements:
259
- - - '>='
259
+ - - ">="
260
260
  - !ruby/object:Gem::Version
261
261
  version: 1.3.6
262
262
  requirements: []
263
263
  rubyforge_project:
264
- rubygems_version: 2.4.5
264
+ rubygems_version: 2.2.2
265
265
  signing_key:
266
266
  specification_version: 4
267
267
  summary: The easiest way to write a Slack bot in Ruby.