lib/ruboty/adapters/slack_rtm.rb in ruboty-slack_rtm-1.0.0 vs lib/ruboty/adapters/slack_rtm.rb in ruboty-slack_rtm-1.0.1
- old
+ new
@@ -72,11 +72,11 @@
# event handlers
def on_message(data)
data = resolve_mention!(data)
- user = user_info(data['user'])
+ user = user_info(data['user']) || {}
robot.receive(
body: data['text'],
from: data['channel'],
from_name: user['name'],
@@ -197,9 +197,11 @@
end
end
end
def user_info(user_id)
+ return {} if user_id.to_s.empty?
+
@user_info_caches[user_id] ||= begin
resp = client.users_info(user: user_id)
resp['user']
end