lib/ruboty/adapters/slack_rtm.rb in ruboty-slack_rtm-0.0.1 vs lib/ruboty/adapters/slack_rtm.rb in ruboty-slack_rtm-0.0.2
- old
+ new
@@ -78,10 +78,11 @@
from: data['channel'],
from_name: user['name'],
to: data['channel'],
channel: channel_info(data['channel']),
user: user,
+ mention_to: data['mention_to'],
time: Time.at(data['ts'].to_f)
)
end
def on_channel_change(data)
@@ -104,10 +105,10 @@
def resolve_mention!(data)
data = data.dup
data['mention_to'] = []
- data['text'].gsub!(/\<\@(?<uid>[0-9A-Z]+)\>/) do |_|
+ (data['text'] || '').gsub!(/\<\@(?<uid>[0-9A-Z]+)\>/) do |_|
user = user_info(Regexp.last_match[:uid])
data['mention_to'] << user
"@#{user['name']}"