sps_bot 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cdcdf2ad7477331d1a755e6394e8669808c39fe
4
- data.tar.gz: 3ade3a1ab3191d376cc0716f1bee29ad1aa4de77
3
+ metadata.gz: 8d501c4f66fc602f325069c5ecd8aa11c98bd0b3
4
+ data.tar.gz: ab872c3cfe23a12aa96da2be554119b7f1c30095
5
5
  SHA512:
6
- metadata.gz: 0759f72b90e270c4c6373cd8e44168ebc4c2ffac3d5ceb574de95d1a21453353b51941457c75efe24fff9d15b5c1cf4e4576b658ccee745278e793da26ab1e3a
7
- data.tar.gz: c4910cc60cd0292ddb877f86afd1186ca6c279515d00136343ca747aecac1265896fab5d4a526186e8900ee1c22f30d2c71680c4f1ffd7514ff9874300d7ac80
6
+ metadata.gz: ae7aaac46f503695756aa1a36fff24a1ce242d5b6fed75e834c9b4a38e21c325558bce274cba622bacc23247169dfd419396c3aef3dc8d868f11b0708a2ca58a
7
+ data.tar.gz: 80b17e7a562c3f8a6b62825961acefb6130010bf64eebd14da8625d55350fd2b48b53bea0921804ef4debe97e2e4a91d5e8978202f65c239239639e6ab2ed5d3
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/sps_bot.rb CHANGED
@@ -3,51 +3,30 @@
3
3
  # file: sps_bot.rb
4
4
 
5
5
  require 'sps_chat'
6
+ require 'botbase'
6
7
 
7
8
 
8
9
  class SpsBot < SPSChat
9
10
 
10
- def initialize(host: 'localhost', port: '8080', userid: 'bot',
11
- service_modules: nil, room: '')
11
+ def initialize(host: '127.0.0.1', port: '8080', userid: 'bot', room: '',
12
+ config: nil, typing_mode: false)
12
13
 
13
14
  super(host: host, port: port, userid: userid, room: room)
14
-
15
- @phrases = {}
16
-
17
- a = if service_modules then
18
-
19
- service_modules
20
-
21
- else
22
-
23
- h = {
24
- "^What's the time?" => "'The time is ' + Time.now.strftime(\"%-I:%M%p\")",
25
- "hello?" => %q("hello #{sender}, how can I help you?" % sender),
26
- 'unknown' => "\"I'm sorry, I don't understand what you said.\""
27
- }
28
- [h]
29
-
30
- end
31
-
32
- a.each {|x| @phrases.merge! x }
15
+ @bot = BotBase.new config
16
+ @typing_mode = typing_mode
33
17
 
34
18
  end
35
19
 
36
- def onincoming(sender, msg)
37
-
38
- r = @phrases.detect {|k,v| msg =~ /#{k}/i }
39
-
40
- raw_msg = if r then
41
- r.last
42
- else
43
- unknown = h['unknown']
44
- unknown.last if unknown
45
- end
20
+ def onincoming(sender, msg, typing_mode=false)
46
21
 
47
- response = eval raw_msg
22
+ if not typing_mode then
23
+ #msg = 'tim'
24
+
25
+ response = @bot.received sender, msg
48
26
 
49
- self.send response
27
+ self.send response
28
+ end
50
29
 
51
30
  end
52
31
 
53
- end
32
+ end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sps_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,10 +31,30 @@ cert_chain:
31
31
  C9953c/cW9RSvURZAGzbWWYlJrpUPx8rLJTUfpphqF+p4HssT5ddVIfb9sGiiRrL
32
32
  FproyCdNk6P65Q==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-04-16 00:00:00.000000000 Z
34
+ date: 2016-07-27 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sps_chat
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.1'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.2
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.1'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.1.2
56
+ - !ruby/object:Gem::Dependency
57
+ name: botbase
38
58
  requirement: !ruby/object:Gem::Requirement
39
59
  requirements:
40
60
  - - "~>"
@@ -80,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
100
  version: '0'
81
101
  requirements: []
82
102
  rubyforge_project:
83
- rubygems_version: 2.4.8
103
+ rubygems_version: 2.5.1
84
104
  signing_key:
85
105
  specification_version: 4
86
106
  summary: The sps_bot gem allows you to chat with your very own bot through the sps_chat
metadata.gz.sig CHANGED
Binary file