ruboty-line_bot 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ruboty/action_tweaks.rb +1 -1
- data/lib/ruboty/adapters/line_bot.rb +20 -4
- data/lib/ruboty/line_bot/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: c4b6fe36c1ecb277e596e83f967fe15cb7502dd2
|
4
|
+
data.tar.gz: bbd2a46f1359bb2b661b8cb05bc7d20d59eb9c85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1b7a575200b88543bd6ae7f546325a716cb4ad8cbfd1e7802a57cf32377b167ff42b635c2d07f917b1608f0e8a7d86b720a7c19acb3688f3b6f574caffd2914
|
7
|
+
data.tar.gz: 7dc08ecc98fb30cca37e1f4226bebe121d4bd1165289edddb647a56ad0bb01f07fd79a1ce8f25f0790e5f7b12b2639a92d4f9c116bba16430b10c3bf2df3e07f
|
data/README.md
CHANGED
@@ -16,5 +16,5 @@ LINE_CHANNEL_MID - LINE Channel MID
|
|
16
16
|
LINE_SERVER_BIND_ADDRESS - Bind address (default: 0.0.0.0)
|
17
17
|
LINE_SERVER_PORT - Port (default: 4567)
|
18
18
|
LINE_SERVER_ENDPOINT - Endpoint (default: /callback)
|
19
|
-
RESPOND_TO_ALL - Pass 1 to force ruboty to respond all
|
19
|
+
RESPOND_TO_ALL - Pass 1 to force ruboty to respond all messages without mention
|
20
20
|
```
|
data/lib/ruboty/action_tweaks.rb
CHANGED
@@ -20,6 +20,7 @@ module Ruboty
|
|
20
20
|
|
21
21
|
def init
|
22
22
|
@queue = Queue.new
|
23
|
+
@cached_contacts = {}
|
23
24
|
end
|
24
25
|
|
25
26
|
def say(message)
|
@@ -84,11 +85,26 @@ module Ruboty
|
|
84
85
|
|
85
86
|
keys = [:id, :from_mid, :to_mid, :from_channel_id, :to_channel_id, :event_type, :created_time, :content]
|
86
87
|
message = keys.each_with_object({}) {|key, hash| hash[key] = event.send(key) }
|
88
|
+
|
89
|
+
unless contact = @cached_contacts[message[:from_mid]]
|
90
|
+
contact = client.get_user_profile(message[:from_mid]).contacts.first
|
91
|
+
@cached_contacts.update({
|
92
|
+
contact.mid => {
|
93
|
+
mid: contact.mid,
|
94
|
+
display_name: contact.display_name,
|
95
|
+
picture_url: contact.picture_url,
|
96
|
+
status_message: contact.status_message,
|
97
|
+
}
|
98
|
+
})
|
99
|
+
contact = @cached_contacts[contact.mid]
|
100
|
+
end
|
101
|
+
|
87
102
|
message.update(
|
88
|
-
body:
|
89
|
-
from:
|
90
|
-
|
91
|
-
|
103
|
+
body: message[:content].content[:text],
|
104
|
+
from: message[:from_mid],
|
105
|
+
from_name: contact[:display_name],
|
106
|
+
to: message[:to_mid],
|
107
|
+
type: message[:event_type],
|
92
108
|
)
|
93
109
|
Ruboty.logger.debug('Received:' + message.inspect)
|
94
110
|
robot.receive(message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-line_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- meganemura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|