lita-idobata 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/adapters/idobata/connector.rb +8 -1
- data/lib/lita/idobata/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36c42052b763a441cc33f94e38629f7fbae469d2
|
4
|
+
data.tar.gz: 55ba52535316332dae34a57961994a05d2906fef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f08f8ddbd3f0b39ff0b0d21a91b338a51e2ab3547c0feaaa7867ec1e37cb0e53a072eecdda8bb74de9b65d82a1b13ec2fa087681cb16d5cb979f6ac2ea1404a
|
7
|
+
data.tar.gz: 87e6ccbcd9591319d645bb1539d9f4e55fee88650b4eee9c06cb226cf3bcbca1a293dcacc948fb4ace2ea0f3614d2c2377d854fd847d7ee713bd360840a36fd0
|
@@ -42,7 +42,7 @@ module Lita
|
|
42
42
|
socket.bind('message:created') do |data|
|
43
43
|
message = JSON.parse(data)["message"]
|
44
44
|
if message["sender_id"] != @bot['id']
|
45
|
-
user =
|
45
|
+
user = find_user(*message.values_at('sender_id', 'sender_name', 'sender_type'))
|
46
46
|
source = Source.new(user: user, room: message["room_id"])
|
47
47
|
# `message["body_plain"]` is nil on image upload
|
48
48
|
message = Message.new(robot, message["body_plain"].to_s, source)
|
@@ -71,6 +71,13 @@ module Lita
|
|
71
71
|
|
72
72
|
private
|
73
73
|
|
74
|
+
def find_user(id, name, type)
|
75
|
+
# hook has no personality, it's only a machine
|
76
|
+
return User.new(id, name: name) if type == 'HookEndpoint'
|
77
|
+
|
78
|
+
User.find_by_id(id) || User.create(id, name: name)
|
79
|
+
end
|
80
|
+
|
74
81
|
def auth_method
|
75
82
|
-> (socket_id, channel) {
|
76
83
|
response = http_client.post "/pusher/auth", { channel_name: channel.name, socket_id: socket_id }
|
data/lib/lita/idobata/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-idobata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fukayatsu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|