ruboty-slack_rtm 3.0.0 → 3.2.2

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
  SHA256:
3
- metadata.gz: 8e8844797bbc88f71e3e67b3e7c428da8f6435de38447284ef8fbf96c53d7d0e
4
- data.tar.gz: 0a77ab41f21d5ed9fbc057a006d88b056a10f4726fe175cd3f263ad4d39f4db1
3
+ metadata.gz: 429f0cee022b0da4ec4647dbae78fc5f095db755a7a25ed59f291742d20c5ead
4
+ data.tar.gz: 5570cb0fe2e14591d36aea251aa7b5b7af29fbd010e95650500506fe7601b360
5
5
  SHA512:
6
- metadata.gz: 54067fd413c3e1b5f7c808697938f0624499841e6451344e1e92af1668d45626e367bf1daaac2a529a76ce0c4477234b63fc0b09e0adf41201e601f3dcdd4821
7
- data.tar.gz: 00b247b0f7e7259618030e364e3159f58132e342eb5b488115d996788dd6541e1aed3c6660f0991fd8405c8292a44d4cfe2445e2c6caa0cb00b4ad9d583ff1b3
6
+ metadata.gz: 7298e60f71abc1c364f3f427e91a4a700865ecb9c63a3d7e44a5e75adb4a24ebbe42fdf2aa929783ec7be00615913452ebbffb957ea3e7b48e86de0d1eeca618
7
+ data.tar.gz: 0f4c0f9adafc109eb0f57551c4bf06ad067d9b057857f93221df44721e002034f8d5b4987009887e0b36f7e6c235e47bb3ff58592fe0633edc1d71273ba092ee
@@ -36,7 +36,8 @@ module Ruboty
36
36
  parse: message[:parse] || 'full',
37
37
  unfurl_links: true,
38
38
  as_user: true,
39
- attachments: message[:attachments].to_json
39
+ attachments: message[:attachments].to_json,
40
+ thread_ts: message[:thread_ts] || message[:original][:thread_ts]
40
41
  )
41
42
  elsif message[:file]
42
43
  path = message[:file][:path]
@@ -46,14 +47,16 @@ module Ruboty
46
47
  file: Faraday::UploadIO.new(path, message[:file][:content_type]),
47
48
  title: message[:file][:title] || path,
48
49
  filename: File.basename(path),
49
- initial_comment: message[:body] || ''
50
+ initial_comment: message[:body] || '',
51
+ thread_ts: message[:thread_ts] || message[:original][:thread_ts]
50
52
  )
51
53
  else
52
- realtime.send_message(
53
- type: 'message',
54
+ client.chat_postMessage(
54
55
  channel: channel,
55
56
  text: message[:code] ? "```\n#{message[:body]}\n```" : resolve_send_mention(message[:body]),
56
- mrkdwn: true
57
+ as_user: true,
58
+ mrkdwn: true,
59
+ thread_ts: message[:thread_ts] || message[:original][:thread_ts]
57
60
  )
58
61
  end
59
62
  end
@@ -97,6 +100,8 @@ module Ruboty
97
100
  break unless ENV['SLACK_AUTO_RECONNECT']
98
101
  @url = nil
99
102
  @realtime = nil
103
+ sleep 3
104
+ bind
100
105
  end
101
106
  end
102
107
 
@@ -154,6 +159,8 @@ module Ruboty
154
159
  to: channel_to,
155
160
  channel: channel,
156
161
  user: user,
162
+ ts: data['ts'],
163
+ thread_ts: data['thread_ts'],
157
164
  time: Time.at(data['ts'].to_f)
158
165
  }
159
166
 
@@ -235,7 +242,7 @@ module Ruboty
235
242
  end
236
243
 
237
244
  def resolve_send_mention(text)
238
- text = text.to_s
245
+ text = text.dup.to_s
239
246
  text.gsub!(/@(?<mention>[0-9a-z._-]+)/) do |_|
240
247
  mention = Regexp.last_match[:mention]
241
248
  msg = "@#{mention}"
@@ -322,7 +329,7 @@ module Ruboty
322
329
  @channel_info_caches[channel_id] ||= begin
323
330
  resp = case channel_id
324
331
  when /^C/
325
- client.channels_info(channel: channel_id)
332
+ client.conversations_info(channel: channel_id)
326
333
  else
327
334
  {}
328
335
  end
@@ -65,7 +65,13 @@ module Ruboty
65
65
  Thread.start do
66
66
  loop do
67
67
  sleep(30)
68
- @client.send('', type: 'ping')
68
+ begin
69
+ @client.send('', type: 'ping')
70
+ rescue => e
71
+ Ruboty.logger.error("#{e.class}: #{e.message}\n#{e.backtrace.join("\n")}")
72
+ @queue.enq(CONNECTION_CLOSED)
73
+ break
74
+ end
69
75
  end
70
76
  end
71
77
  end
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module SlackRTM
3
- VERSION = '3.0.0'
3
+ VERSION = '3.2.2'
4
4
  end
5
5
  end
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.7'
22
- spec.add_development_dependency 'rake', '~> 12.3'
21
+ spec.add_development_dependency 'bundler'
22
+ spec.add_development_dependency 'rake'
23
23
  spec.add_development_dependency 'rubocop', '>= 0.28.0'
24
24
 
25
25
  spec.add_dependency 'ruboty', '>= 1.1.4'
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-slack_rtm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-11 00:00:00.000000000 Z
11
+ date: 2021-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '12.3'
33
+ version: '0'
34
34
  type: :development
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: '12.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +132,7 @@ homepage: https://github.com/rosylilly/ruboty-slack_rtm
132
132
  licenses:
133
133
  - MIT
134
134
  metadata: {}
135
- post_install_message:
135
+ post_install_message:
136
136
  rdoc_options: []
137
137
  require_paths:
138
138
  - lib
@@ -147,9 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  - !ruby/object:Gem::Version
148
148
  version: '0'
149
149
  requirements: []
150
- rubyforge_project:
151
- rubygems_version: 2.7.6
152
- signing_key:
150
+ rubygems_version: 3.1.4
151
+ signing_key:
153
152
  specification_version: 4
154
153
  summary: Slack real time messaging adapter for Ruboty
155
154
  test_files: []