ruboty-slack_rtm 2.3.0 → 2.4.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: b8b132d94e6b54aadda6cfe398f55e4431b165f5
4
- data.tar.gz: 224dd734bc0e1bffdae46932d819c97ac74ef8e6
3
+ metadata.gz: 7df14a42a9fbf710f494cee00b2fe483416085c2
4
+ data.tar.gz: fc3cf45180317c08511ceef50193c73f996db918
5
5
  SHA512:
6
- metadata.gz: e34dcdc874d34b809eae3aedf9c95a3faa8892f69ccf6cb31658caedf95500f9ecee5ba87ff91be2dcb364eeceba067818f254bfd85d63cb758265545969ce37
7
- data.tar.gz: 163740287c666ca50ac2b96237c5b7bed57a51a1b395d80f71a9756c54f5c9f0977e7ce6eeb17643918d0e1e0122d8029070a8919dbbf0bfb8a76ddee1074591
6
+ metadata.gz: 907ec5897036d18a1f24b173e5bf503550795820b84109958966a36447b6b72750fac259f58148f771e74862a7ca4ecfce1bee2d3eb631819d5aae71aa8d6317
7
+ data.tar.gz: 15374cc7a8d10c0186ee70167baf91de71a8dfa2a4d89b78291b494436237154e2a2810b23eb73f0fd3ab046c48629049d5dace7e3dc0df4fcca760c4e833ff4
@@ -104,7 +104,7 @@ module Ruboty
104
104
 
105
105
  channel = channel_info(data['channel'])
106
106
 
107
- if data['type'] == 'bot_message' && ENV['SLACK_IGNORE_BOT_MESSAGE'] == '1'
107
+ if data['subtype'] == 'bot_message' && ENV['SLACK_IGNORE_BOT_MESSAGE'] == '1'
108
108
  return
109
109
  end
110
110
 
@@ -116,8 +116,7 @@ module Ruboty
116
116
  channel_to = data['channel']
117
117
  end
118
118
 
119
- robot.receive(
120
- body: CGI.unescapeHTML(data['text']),
119
+ message_info = {
121
120
  from: data['channel'],
122
121
  from_name: user['name'],
123
122
  to: channel_to,
@@ -125,10 +124,16 @@ module Ruboty
125
124
  user: user,
126
125
  mention_to: data['mention_to'],
127
126
  time: Time.at(data['ts'].to_f)
128
- )
129
- end
127
+ }
128
+
129
+ robot.receive(message_info.merge(body: CGI.unescapeHTML(data['text']))
130
130
 
131
- alias on_bot_message on_message
131
+ (data['attachments'] || []).each do |attachment|
132
+ body = (attachments['fallback'] || "#{attachment['text']} #{attachment['pretext']}").to_s
133
+
134
+ robot.receive(message_info.merge(body: CGI.unescapeHTML(body)) unless text.empty?
135
+ end
136
+ end
132
137
 
133
138
  def on_channel_change(data)
134
139
  make_channels_cache
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module SlackRTM
3
- VERSION = '2.3.0'
3
+ VERSION = '2.4.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-slack_rtm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano