ruboty-slack_rtm 1.0.1 → 1.1.0

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: 718c5fe60cd112fc3e5f9f1ace971c856e78f12d
4
- data.tar.gz: 266e861ed9767c9617ece2370252ef9b8c74796b
3
+ metadata.gz: f95736f27208e55dcea4fad8b2cd2335ca3bfcd3
4
+ data.tar.gz: 141a8135f8c1765193d09834f4a452ce034f0124
5
5
  SHA512:
6
- metadata.gz: c5e3b241f0ae37e7484aa02a7134e429327e51ede86c6874aa78d5475a4fa6497bd8bc66765bd818270158699de6169e2794973d5d5cc967724accab0edc2ff7
7
- data.tar.gz: 78fe9e8cee1514c7dc053d6acaeadcd59e8c1a1f33dcf3787e5c8d81a23b946af54609c68092dcb9fd8ec05db7c5cf01b421764c5376dcd3fbf017586b0e2477
6
+ metadata.gz: 8f9413b2f75f3de4854295805c4ef7ecb878b9f2eb5fe55f2595265ef0e54e7ed46c26f8c290d22973b107c9cdc3a9e25e75fb25ad304d7f7a990739fd0ad4c9
7
+ data.tar.gz: 484e7ce9b6ec14d2222d2278f4599d964a78c3e9adfe4b5db5fd71ec9ea7e65df632b41b0b9926b60cdf3388e6d551495f7f599b0391e5038caaa01d520fa524
@@ -15,9 +15,16 @@ module Ruboty
15
15
  end
16
16
 
17
17
  def say(message)
18
+ channel = message[:to]
19
+ if channel[0] == '#'
20
+ channel = resolve_channel_id(channel[1..-1])
21
+ end
22
+
23
+ return unless channel
24
+
18
25
  realtime.send(
19
26
  type: 'message',
20
- channel: message[:to],
27
+ channel: channel,
21
28
  text: message[:code] ? "```\n#{message[:body]}\n```" : resolve_send_mention(message[:body]),
22
29
  mrkdwn: true
23
30
  )
@@ -220,6 +227,17 @@ module Ruboty
220
227
  resp['channel']
221
228
  end
222
229
  end
230
+
231
+ def resolve_channel_id(name)
232
+ ret_id = nil
233
+ @channel_info_cahces.each_pair do |id, channel|
234
+ if channel['name'] == name
235
+ ret_id = id
236
+ break
237
+ end
238
+ end
239
+ return ret_id
240
+ end
223
241
  end
224
242
  end
225
243
  end
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module SlackRTM
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-slack_rtm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-03 00:00:00.000000000 Z
11
+ date: 2015-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.4.5
134
+ rubygems_version: 2.4.6
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Slack real time messaging adapter for Ruboty