ruboty-response 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruboty/handlers/response.rb +2 -15
- data/lib/ruboty/response/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a35bed6b5959dcee4da3803d93a4f0d2671b17e6
|
4
|
+
data.tar.gz: ef1cf0323809bfd8ea36934855a2da903906f003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef091a4f81f6a4f0ec4a876eb376d5ae60a83c50fdfb257b7db961402834dfa34e1f3200b29642c56a279a1f43fe4268c95a1192d99dc7920ce4ad99d5a9be71
|
7
|
+
data.tar.gz: 114e156b266de488dd51d8f6c39e13695ce3cd089f41f068b2e6dc9aa269af2df134f6aa72cb3fe424f2054dbac472b62089f0031b21f4b4ae6f93f009c66a9b
|
@@ -7,7 +7,7 @@ module Ruboty
|
|
7
7
|
|
8
8
|
on /(?<keyword>.+)/, name: 'catchall', hidden: true, all: true
|
9
9
|
|
10
|
-
on /add response \/(?<regex>.+?)\/ (?<response
|
10
|
+
on /add response \/(?<regex>.+?)\/ (?<response>.+)/, name: 'add', description: 'Add a response'
|
11
11
|
on /delete response (?<id>.+)/, name: 'delete', description: 'Delete a response'
|
12
12
|
on /list responses\z/, name: 'list', description: 'Show registered responses'
|
13
13
|
|
@@ -15,20 +15,7 @@ module Ruboty
|
|
15
15
|
responses.each do |id, hash|
|
16
16
|
next unless message[:keyword] =~ /#{hash[:regex]}/ rescue false
|
17
17
|
|
18
|
-
|
19
|
-
if match_data = hash[:response].match(/\A`(?<code>.+)`\z/)
|
20
|
-
thread = Thread.start do
|
21
|
-
stdout, stderr, _status = Open3.capture3(match_data[:code])
|
22
|
-
message.reply(stdout.chomp) if stdout
|
23
|
-
message.reply(stderr.chomp) if stderr
|
24
|
-
end
|
25
|
-
Thread.start do
|
26
|
-
sleep 10
|
27
|
-
thread.kill
|
28
|
-
end
|
29
|
-
else
|
30
|
-
message.reply(hash[:response])
|
31
|
-
end
|
18
|
+
message.reply(hash[:response])
|
32
19
|
end
|
33
20
|
rescue => e
|
34
21
|
Ruboty.logger.error("Error: #{e.class}: #{e.message}}")
|
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: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kaihar4
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruboty
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
90
|
rubyforge_project:
|
91
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.6.8
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: Ruboty handler to register a response.
|