chatscript 0.0.7 → 0.0.8
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/lib/chatscript.rb +4 -19
- data/lib/chatscript/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: f82757d31016052945a071dd16e09cf48c6fdabb
|
4
|
+
data.tar.gz: 6f85ad8a3ee26aa31c9b5559f47c3b52e65d1712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 673b40c711880378a539865a3d2981ebda0477263ffbb0a8adfb6c0d0bc8399c1264ca2b7b40c765c2696273f3f5ca32f77262db466ad8bb4ccf871a8f682608
|
7
|
+
data.tar.gz: d0b8cab9834739b4bb98a06f0c9a5745a0a18cb20924ba71245398ccdb0eac724a646523bbe4d2becef2b557c359a1c43e7f5fdbce7688558542c79ef49ad3ea
|
data/lib/chatscript.rb
CHANGED
@@ -10,21 +10,6 @@ module ChatScript
|
|
10
10
|
class Message
|
11
11
|
attr_accessor :text, :oob
|
12
12
|
|
13
|
-
#
|
14
|
-
# msg = ChatScript::Message.new 'Bonjour a tout le monde', oob: 'salut()'
|
15
|
-
# msg.text
|
16
|
-
# => "Bonjour a tout le monde"
|
17
|
-
# msg.oob
|
18
|
-
# => "salut()"
|
19
|
-
#
|
20
|
-
# msg = ChatScript::Message.new '[ this is a oob message ] hi there! '
|
21
|
-
# msg.text
|
22
|
-
# => "hi there!"
|
23
|
-
# msg.oob
|
24
|
-
# => "this is a oob message"
|
25
|
-
# msg.to_str
|
26
|
-
# => "[ this is a oob message ] hi there!"
|
27
|
-
#
|
28
13
|
def initialize(text = '', oob: '')
|
29
14
|
if text.match(/\[.*\]/).nil?
|
30
15
|
# no oob inside txt
|
@@ -35,8 +20,8 @@ module ChatScript
|
|
35
20
|
@oob, @text = text.match(/\[(.*)\](.*)/).captures
|
36
21
|
|
37
22
|
# remove any blanks
|
38
|
-
@oob.strip!
|
39
23
|
@text.strip!
|
24
|
+
@oob.strip!
|
40
25
|
end
|
41
26
|
end
|
42
27
|
|
@@ -86,15 +71,15 @@ module ChatScript
|
|
86
71
|
# first volley
|
87
72
|
# user message is null (void string)
|
88
73
|
#
|
89
|
-
def start(user
|
90
|
-
volley(
|
74
|
+
def start( user: @defaultuser )
|
75
|
+
volley( '', user: user )
|
91
76
|
end
|
92
77
|
|
93
78
|
|
94
79
|
#
|
95
80
|
# send a user message to the bot and get the bot reply
|
96
81
|
#
|
97
|
-
def volley( user
|
82
|
+
def volley( message, user: @default_user )
|
98
83
|
begin
|
99
84
|
# open client socket
|
100
85
|
socket = TCPSocket.open(@hostname, @port)
|
data/lib/chatscript/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chatscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giorgio Robino
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|