ruboty-response 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ruboty/handlers/response.rb +12 -14
- data/lib/ruboty/response/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: a3bf40f5fc68b13548d71aa1d00c1b382a2ee51c
|
4
|
+
data.tar.gz: d16615139a10a828f4f542840bf59c2b7d049968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1866ebc309e466d32c8e2bf5ae9daa55d8a359d46f09d5e1360f467c7e189b740ab3bdc17a8c6b57ae75094998ca1ea849e5cdebb7a877963da7b56ffd4a664e
|
7
|
+
data.tar.gz: 8dc97b22585c9013462c509f65883ba0b71b01562bf7821417a6ddb3bd7c329e829297100c8188237024ef0ad72795a5247a478d32f22814561efd2d43e666ce
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ module Ruboty
|
|
7
7
|
|
8
8
|
on /add response \/(?<regex>.+)\/ (?<response>.+)/, name: 'add', description: 'Add a response'
|
9
9
|
on /delete response (?<id>.+)/, name: 'delete', description: 'Delete a response'
|
10
|
-
on /list responses/, name: 'list', description: 'Show registered responses'
|
10
|
+
on /list responses\z/, name: 'list', description: 'Show registered responses'
|
11
11
|
|
12
12
|
def catchall(message)
|
13
13
|
responses.each do |id, hash|
|
@@ -27,28 +27,26 @@ module Ruboty
|
|
27
27
|
# Insert to the brain
|
28
28
|
responses[id] = hash
|
29
29
|
|
30
|
-
message.reply("Response #{id} registered.")
|
30
|
+
message.reply("Response #{id} is registered.")
|
31
31
|
end
|
32
32
|
|
33
33
|
def delete(message)
|
34
34
|
if responses.delete(message[:id].to_i)
|
35
|
-
message.reply(
|
35
|
+
message.reply("Response #{message[:id]} is unregistered.")
|
36
36
|
else
|
37
|
-
message.reply(
|
37
|
+
message.reply("Response #{message[:id]} is not found.")
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
def list(message)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
message.reply(body)
|
42
|
+
if responses.empty?
|
43
|
+
message.reply('Nothing is registered.')
|
44
|
+
else
|
45
|
+
response_list = responses.map do |id, hash|
|
46
|
+
"#{id}: /#{hash[:regex]}/ -> #{hash[:response]}"
|
47
|
+
end.join("\n")
|
48
|
+
message.reply(response_list, code: true)
|
49
|
+
end
|
52
50
|
end
|
53
51
|
|
54
52
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-response
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaihar4
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|