botbase 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/botbase.rb +20 -9
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc957a6d66c5bc5020b861b8d31725e15b09ea35
|
4
|
+
data.tar.gz: c5b9e9e8e7cffaafd9ec8dab70bac5f7db44c865
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fbf629f64b671f3e5292e34f83b187d694272f88e77e1013e13d0e4c4f207bad7c0f50b2d62dbb57a3b7a6db9d13510162abbb4bb26ebdbcdb6529f249f873d
|
7
|
+
data.tar.gz: d8e644a3a3883e42a19c0ca30bd27f3f98a0baf3ebb82586d41754cce9a47dc608c03b6fd4ed91e8210d3529d4f51222f840d10f929d96048363bad9b39b1342
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/botbase.rb
CHANGED
@@ -9,32 +9,43 @@ require 'simple-config'
|
|
9
9
|
|
10
10
|
class BotBase
|
11
11
|
|
12
|
-
def initialize(config=nil)
|
12
|
+
def initialize(config=nil, botname: 'Nicole')
|
13
13
|
|
14
|
+
@h = nil
|
14
15
|
|
15
16
|
if config then
|
16
17
|
|
17
|
-
h = SimpleConfig.new(config).to_h
|
18
|
-
|
18
|
+
@h = SimpleConfig.new(config).to_h
|
19
|
+
|
19
20
|
# load the service modules
|
20
|
-
@modules = initialize_modules(h[:modules])
|
21
|
+
@modules = initialize_modules(@h[:modules])
|
21
22
|
|
22
23
|
end
|
24
|
+
|
25
|
+
@botname = botname
|
23
26
|
|
24
27
|
end
|
25
28
|
|
26
29
|
def received(sender='user01', msg)
|
27
30
|
|
31
|
+
self.restart if msg == @botname + ' restart'
|
32
|
+
|
28
33
|
r = nil
|
29
|
-
|
30
|
-
|
31
|
-
end
|
34
|
+
|
35
|
+
msg_recognised = @modules.detect {|m| r = m.query msg }
|
32
36
|
|
33
37
|
return r if msg_recognised
|
34
38
|
|
35
39
|
''
|
36
40
|
|
37
|
-
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def restart
|
44
|
+
|
45
|
+
puts 'restarting ...'
|
46
|
+
@modules = initialize_modules(@h[:modules]) if @h
|
47
|
+
|
48
|
+
end
|
38
49
|
|
39
50
|
private
|
40
51
|
|
@@ -53,4 +64,4 @@ class BotBase
|
|
53
64
|
end
|
54
65
|
|
55
66
|
|
56
|
-
end
|
67
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: botbase
|
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
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
geqYGl52TQMJdtPalCLoH9OSisufD1RK2ECpfXLgoL0hUX9PWk72/FKyb49bB6j5
|
32
32
|
hrQJg0Cu1Hrz3Q==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2017-04-14 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: simple-config
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.6.1
|
56
56
|
description:
|
57
|
-
email: james@
|
57
|
+
email: james@jamesrobertson.eu
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.6.8
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Provides bot functionality primarily for use by the sps_bot gem.
|
metadata.gz.sig
CHANGED
Binary file
|