chatterbot 0.6.6 → 0.7.0
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 +7 -0
- data/README.markdown +13 -6
- data/bin/chatterbot-register +3 -34
- data/chatterbot.gemspec +1 -1
- data/lib/chatterbot.rb +11 -1
- data/lib/chatterbot/bot.rb +1 -0
- data/lib/chatterbot/client.rb +3 -3
- data/lib/chatterbot/config.rb +16 -4
- data/lib/chatterbot/dsl.rb +19 -0
- data/lib/chatterbot/followers.rb +13 -0
- data/lib/chatterbot/skeleton.rb +49 -0
- data/lib/chatterbot/ui.rb +1 -1
- data/lib/chatterbot/version.rb +1 -1
- data/spec/client_spec.rb +3 -3
- data/spec/db_spec.rb +16 -10
- data/spec/dsl_spec.rb +15 -1
- data/spec/followers_spec.rb +19 -0
- data/spec/reply_spec.rb +0 -1
- data/spec/skeleton_spec.rb +29 -0
- data/spec/spec_helper.rb +13 -0
- data/templates/skeleton.txt +37 -0
- metadata +152 -205
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 51a25308f3bbee15e4d9a39112c36f437aacb940
|
4
|
+
data.tar.gz: 688235a797f6cc29d4ba9f140d4b0860df22e29e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 245ebb9adb24c50cb231f200eabb25b8797776f160426a4939dad9514476b4e02cbbe246f58486f67f53ff3d38fe2ef539130a58adb2f470f512d502ded19f91
|
7
|
+
data.tar.gz: 20f78bcef37a7f3afbbc05c5365acec51e84f282992868ab28f8b29dd29bc068b7d8b0fb8f56cff82d9c788a4e4e5583764ba7921eba23a3fbc1df3e85d07d8d
|
data/README.markdown
CHANGED
@@ -131,6 +131,9 @@ precaution if you want to avoid spreading spam), you could call:
|
|
131
131
|
|
132
132
|
exclude "http://"
|
133
133
|
|
134
|
+
**followers** -- get a list of your followers. This is an experimental
|
135
|
+
feature but should work for most purposes.
|
136
|
+
|
134
137
|
For more details, check out dsl.rb in the source code.
|
135
138
|
|
136
139
|
Direct Client Access
|
@@ -200,16 +203,19 @@ Configuration
|
|
200
203
|
Chatterbot offers a couple different methods of storing the config for
|
201
204
|
your bot:
|
202
205
|
|
203
|
-
1.
|
206
|
+
1. Your credentials can be stored as variables in the script itself.
|
207
|
+
`chatterbot-register` will do this for you. If your bot is using
|
208
|
+
replies or searches, that data will be written to a YAML file.
|
209
|
+
2. In a YAML file with the same name as the bot, so if you have
|
204
210
|
botname.rb or a Botname class, store your config in botname.yaml
|
205
|
-
|
211
|
+
3. In a global config file at `/etc/chatterbot.yml` -- values stored here
|
206
212
|
will apply to any bots you run.
|
207
|
-
|
213
|
+
4. In another global config file specified in the environment variable
|
208
214
|
`'chatterbot_config'`.
|
209
|
-
|
215
|
+
5. In a `global.yml` file in the same directory as your bot. This
|
210
216
|
gives you the ability to have a global configuration file, but keep
|
211
217
|
it with your bots if desired.
|
212
|
-
|
218
|
+
6. In a database. You can store your configuration in a DB, and then
|
213
219
|
specify the connection string either in one of the global config
|
214
220
|
files, or on the command-line by using the `--db="db_uri"`
|
215
221
|
configuration option. Any calls to the database are handled by the
|
@@ -308,7 +314,7 @@ sense if requested.
|
|
308
314
|
Copyright/License
|
309
315
|
-----------------
|
310
316
|
|
311
|
-
Copyright (c)
|
317
|
+
Copyright (c) 2013 Colin Mitchell. Chatterbot is distributed under a
|
312
318
|
modified WTFPL licence -- it's the 'Do what the fuck you want to --
|
313
319
|
but don't be an asshole' public license. Please see LICENSE.txt for
|
314
320
|
further details. Basically, do whatever you want with this code, but
|
@@ -318,3 +324,4 @@ expect your karma to suffer.
|
|
318
324
|
|
319
325
|
http://muffinlabs.com
|
320
326
|
|
327
|
+
|
data/bin/chatterbot-register
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
#$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
3
|
|
4
4
|
require 'chatterbot'
|
5
|
+
require 'chatterbot/skeleton'
|
5
6
|
require 'optparse'
|
6
7
|
|
7
8
|
include Chatterbot::Helpers
|
@@ -39,39 +40,6 @@ opts.on_tail("-h", "--help", "Show this message") do
|
|
39
40
|
exit
|
40
41
|
end
|
41
42
|
|
42
|
-
#
|
43
|
-
# skeleton code for a bot -- pretty basic but covers the bases
|
44
|
-
#
|
45
|
-
skeleton = <<'EOF'
|
46
|
-
#!/usr/bin/env ruby
|
47
|
-
|
48
|
-
require 'rubygems'
|
49
|
-
require 'chatterbot/dsl'
|
50
|
-
|
51
|
-
# remove this to send out tweets
|
52
|
-
debug_mode
|
53
|
-
|
54
|
-
# remove this to update the db
|
55
|
-
no_update
|
56
|
-
# remove this to get less output when running
|
57
|
-
verbose
|
58
|
-
|
59
|
-
# here's a list of users to ignore
|
60
|
-
blacklist "abc", "def"
|
61
|
-
|
62
|
-
# here's a list of things to exclude from searches
|
63
|
-
exclude "hi", "spammer", "junk"
|
64
|
-
|
65
|
-
search "keyword" do |tweet|
|
66
|
-
reply "Hey #USER# nice to meet you!", tweet
|
67
|
-
end
|
68
|
-
|
69
|
-
replies do |tweet|
|
70
|
-
reply "Yes #USER#, you are very kind to say that!", tweet
|
71
|
-
end
|
72
|
-
|
73
|
-
EOF
|
74
|
-
|
75
43
|
extra = opts.parse!(ARGV)
|
76
44
|
|
77
45
|
|
@@ -106,7 +74,8 @@ unless @bot.screen_name.nil?
|
|
106
74
|
puts "writing skeleton to #{skel_dest}"
|
107
75
|
|
108
76
|
f = File.new(skel_dest, "w")
|
109
|
-
|
77
|
+
script = Chatterbot::Skeleton.generate(@bot)
|
78
|
+
f.write(script)
|
110
79
|
f.close
|
111
80
|
|
112
81
|
File.chmod(0740, skel_dest)
|
data/chatterbot.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
35
35
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
36
36
|
s.add_development_dependency(%q<rake>, [">= 0"])
|
37
|
-
s.add_development_dependency(%q<rspec>, [">= 2.
|
37
|
+
s.add_development_dependency(%q<rspec>, [">= 2.14.1"])
|
38
38
|
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
39
39
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
40
40
|
s.add_development_dependency(%q<watchr>, [">= 0"])
|
data/lib/chatterbot.rb
CHANGED
@@ -28,7 +28,6 @@ end
|
|
28
28
|
#
|
29
29
|
# the big kahuna!
|
30
30
|
module Chatterbot
|
31
|
-
|
32
31
|
#
|
33
32
|
# load in our assorted modules
|
34
33
|
def self.load
|
@@ -42,10 +41,21 @@ module Chatterbot
|
|
42
41
|
require "chatterbot/tweet"
|
43
42
|
require "chatterbot/retweet"
|
44
43
|
require "chatterbot/reply"
|
44
|
+
require "chatterbot/followers"
|
45
45
|
require "chatterbot/helpers"
|
46
46
|
|
47
47
|
require "chatterbot/bot"
|
48
48
|
end
|
49
|
+
|
50
|
+
require 'chatterbot/version'
|
51
|
+
|
52
|
+
# Return a directory with the project libraries.
|
53
|
+
def self.libdir
|
54
|
+
t = [File.expand_path(File.dirname(__FILE__)), "#{Gem.dir}/gems/chatterbot-#{Chatterbot::VERSION}"]
|
55
|
+
|
56
|
+
t.each {|i| return i if File.readable?(i) }
|
57
|
+
raise "both paths are invalid: #{t}"
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
|
data/lib/chatterbot/bot.rb
CHANGED
data/lib/chatterbot/client.rb
CHANGED
@@ -45,11 +45,11 @@ module Chatterbot
|
|
45
45
|
# the max_id
|
46
46
|
#
|
47
47
|
def reset_since_id
|
48
|
-
|
48
|
+
config[:tmp_since_id] = 0
|
49
|
+
result = client.search("a")
|
49
50
|
update_since_id(result)
|
50
51
|
end
|
51
|
-
|
52
|
-
|
52
|
+
|
53
53
|
|
54
54
|
#
|
55
55
|
# the URL we should use for api calls
|
data/lib/chatterbot/config.rb
CHANGED
@@ -111,28 +111,40 @@ module Chatterbot
|
|
111
111
|
def update_config_at_exit
|
112
112
|
update_config
|
113
113
|
end
|
114
|
+
|
115
|
+
def max_id_from(s)
|
116
|
+
s.max { |a, b| a.id <=> b.id }.id
|
117
|
+
end
|
114
118
|
|
115
119
|
#
|
116
120
|
# update the since_id with either the highest ID of the specified
|
117
121
|
# tweets, unless it is lower than what we have already
|
118
122
|
def update_since_id(search)
|
119
123
|
return if search.nil?
|
124
|
+
|
120
125
|
|
121
126
|
tmp_id = case search
|
122
|
-
when Twitter::SearchResults then
|
127
|
+
when Twitter::SearchResults then
|
128
|
+
# don't use max_id if it's this ridiculous number
|
129
|
+
# @see https://dev.twitter.com/issues/1300
|
130
|
+
if search.max_id != 9223372036854775807
|
131
|
+
search.max_id
|
132
|
+
else
|
133
|
+
max_id_from(search)
|
134
|
+
end
|
123
135
|
|
124
136
|
# incoming tweets
|
125
137
|
when Twitter::Tweet then search.id
|
126
138
|
|
127
139
|
# an enumeration
|
128
|
-
when Array then search
|
140
|
+
when Array then max_id_from(search)
|
129
141
|
|
130
142
|
# probably an actual tweet ID at this point,
|
131
143
|
# otherwise it will fail and return 0
|
132
144
|
else search
|
133
145
|
end.to_i
|
134
146
|
|
135
|
-
config[:tmp_since_id] = [config[:tmp_since_id].to_i, tmp_id].max
|
147
|
+
config[:tmp_since_id] = [config[:tmp_since_id].to_i, tmp_id].max
|
136
148
|
end
|
137
149
|
|
138
150
|
#
|
@@ -175,6 +187,7 @@ module Chatterbot
|
|
175
187
|
Dir.getwd
|
176
188
|
else
|
177
189
|
File.dirname($0)
|
190
|
+
#Dir.pwd
|
178
191
|
end
|
179
192
|
end
|
180
193
|
|
@@ -220,7 +233,6 @@ module Chatterbot
|
|
220
233
|
# get any config from our global config files
|
221
234
|
def global_config
|
222
235
|
tmp = {}
|
223
|
-
|
224
236
|
global_config_files.each { |f|
|
225
237
|
tmp.merge!(slurp_file(f) || {})
|
226
238
|
}
|
data/lib/chatterbot/dsl.rb
CHANGED
@@ -145,6 +145,10 @@ module Chatterbot
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
+
def followers(opts={})
|
149
|
+
bot.followers(opts)
|
150
|
+
end
|
151
|
+
|
148
152
|
#
|
149
153
|
# specify list of strings we will check when deciding to respond
|
150
154
|
# to a tweet or not. accepts an array or a comma-delimited string.
|
@@ -171,6 +175,21 @@ module Chatterbot
|
|
171
175
|
bot.config[:since_id]
|
172
176
|
end
|
173
177
|
|
178
|
+
def consumer_secret(s)
|
179
|
+
bot.config[:consumer_secret] = s
|
180
|
+
end
|
181
|
+
|
182
|
+
def consumer_key(k)
|
183
|
+
bot.config[:consumer_key] = k
|
184
|
+
end
|
185
|
+
|
186
|
+
def secret(s)
|
187
|
+
bot.config[:secret] = s
|
188
|
+
end
|
189
|
+
def token(s)
|
190
|
+
bot.config[:token] = s
|
191
|
+
end
|
192
|
+
|
174
193
|
#
|
175
194
|
# explicitly save the configuration/state of the bot.
|
176
195
|
#
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Chatterbot
|
2
|
+
|
3
|
+
#
|
4
|
+
# bot template generator
|
5
|
+
class Skeleton
|
6
|
+
class << self
|
7
|
+
def generate(bot)
|
8
|
+
path = File.join(Chatterbot.libdir, "..", "templates", "skeleton.txt")
|
9
|
+
src = File.read(path)
|
10
|
+
opts = bot.config.merge({
|
11
|
+
:name => bot.botname,
|
12
|
+
:timestamp => Time.now
|
13
|
+
})
|
14
|
+
|
15
|
+
if RUBY_VERSION =~ /^1\.8\./
|
16
|
+
apply_vars(src, opts)
|
17
|
+
else
|
18
|
+
src % opts
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# handle string interpolation in ruby 1.8. modified from
|
24
|
+
# https://raw.github.com/svenfuchs/i18n/master/lib/i18n/core_ext/string/interpolate.rb
|
25
|
+
#
|
26
|
+
def apply_vars(s, args)
|
27
|
+
pattern = Regexp.union(
|
28
|
+
/%\{(\w+)\}/, # matches placeholders like "%{foo}"
|
29
|
+
/%<(\w+)>(.*?\d*\.?\d*[bBdiouxXeEfgGcps])/ # matches placeholders like "%<foo>.d"
|
30
|
+
)
|
31
|
+
|
32
|
+
pattern_with_escape = Regexp.union(
|
33
|
+
/%%/,
|
34
|
+
pattern
|
35
|
+
)
|
36
|
+
|
37
|
+
s.gsub(pattern_with_escape) do |match|
|
38
|
+
if match == '%%'
|
39
|
+
'%'
|
40
|
+
else
|
41
|
+
key = ($1 || $2).to_sym
|
42
|
+
raise KeyError unless args.has_key?(key)
|
43
|
+
$3 ? sprintf("%#{$3}", args[key]) : args[key]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/chatterbot/ui.rb
CHANGED
data/lib/chatterbot/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -10,9 +10,9 @@ describe "Chatterbot::Client" do
|
|
10
10
|
it "runs a search to get a new max_id" do
|
11
11
|
bot = test_bot
|
12
12
|
|
13
|
-
bot.stub!(:
|
14
|
-
bot.
|
15
|
-
bot.search("a")
|
13
|
+
bot.stub!(:client).and_return(fake_search(100, 1))
|
14
|
+
bot.client.should_receive(:search).with("a")
|
15
|
+
# bot.search("a")
|
16
16
|
bot.reset_since_id
|
17
17
|
|
18
18
|
bot.config[:tmp_since_id].should == 100
|
data/spec/db_spec.rb
CHANGED
@@ -1,26 +1,32 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
require 'sequel'
|
3
|
+
#require 'sequel'
|
4
4
|
|
5
5
|
describe "Chatterbot::DB" do
|
6
6
|
before(:each) do
|
7
7
|
@db_uri = "sqlite:/tmp/chatterbot.db"
|
8
8
|
File.delete("/tmp/chatterbot.db") if File.exist?("/tmp/chatterbot.db")
|
9
|
-
|
10
|
-
@bot = Chatterbot::Bot.new
|
11
|
-
@bot.stub!(:update_config_at_exit)
|
12
|
-
@bot.config[:db_uri] = @db_uri
|
13
9
|
end
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
context "prerequisites" do
|
12
|
+
describe "get_connection" do
|
13
|
+
it "should make sure sequel is actually installed" do
|
14
|
+
Chatterbot::Bot.any_instance.stub(:has_sequel?) { false }
|
15
|
+
@bot = Chatterbot::Bot.new
|
16
|
+
@bot.config[:db_uri] = @db_uri
|
17
|
+
@bot.should_receive(:display_db_config_notice)
|
18
|
+
@bot.db
|
19
|
+
end
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
context "db interactions" do
|
24
|
+
before(:each) do
|
25
|
+
@bot = Chatterbot::Bot.new
|
26
|
+
@bot.stub!(:update_config_at_exit)
|
27
|
+
@bot.config[:db_uri] = @db_uri
|
28
|
+
end
|
29
|
+
|
24
30
|
after(:each) do
|
25
31
|
@bot.db.disconnect unless @bot.db.nil?
|
26
32
|
end
|
data/spec/dsl_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
describe "Chatterbot::DSL" do
|
4
4
|
describe "client routines" do
|
5
5
|
before(:each) do
|
6
|
-
@bot = mock(Chatterbot::Bot)
|
6
|
+
@bot = mock(Chatterbot::Bot, :config => {})
|
7
7
|
@bot.send :require, 'chatterbot/dsl'
|
8
8
|
|
9
9
|
Chatterbot::DSL.stub!(:bot).and_return(@bot)
|
@@ -84,6 +84,11 @@ describe "Chatterbot::DSL" do
|
|
84
84
|
replies
|
85
85
|
end
|
86
86
|
|
87
|
+
it "#followers passes along to bot object" do
|
88
|
+
@bot.should_receive(:followers)
|
89
|
+
followers
|
90
|
+
end
|
91
|
+
|
87
92
|
it "#tweet passes along to bot object" do
|
88
93
|
@bot.should_receive(:tweet).with("hello sailor!", {:foo => "bar" }, nil)
|
89
94
|
tweet "hello sailor!", {:foo => "bar"}
|
@@ -94,6 +99,15 @@ describe "Chatterbot::DSL" do
|
|
94
99
|
reply "hello sailor!", { :source => "source "}
|
95
100
|
end
|
96
101
|
|
102
|
+
context "setters" do
|
103
|
+
[:consumer_secret, :consumer_key, :token, :secret].each do |k|
|
104
|
+
it "should be able to set #{k}" do
|
105
|
+
send(k, "foo")
|
106
|
+
@bot.config[k].should == "foo"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
97
111
|
describe "update_config" do
|
98
112
|
it "should pass to bot object" do
|
99
113
|
@bot.should_receive(:update_config)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Chatterbot::Followers" do
|
4
|
+
it "calls require_login" do
|
5
|
+
bot = test_bot
|
6
|
+
bot.should_receive(:require_login).and_return(false)
|
7
|
+
bot.followers
|
8
|
+
end
|
9
|
+
|
10
|
+
it "returns followers" do
|
11
|
+
bot = test_bot
|
12
|
+
bot.should_receive(:require_login).and_return(true)
|
13
|
+
bot.stub!(:client).and_return(fake_followers(3))
|
14
|
+
|
15
|
+
result = bot.followers
|
16
|
+
result.size.should == 3
|
17
|
+
result[0].name.should == "Follower 1"
|
18
|
+
end
|
19
|
+
end
|
data/spec/reply_spec.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
require 'chatterbot/skeleton'
|
4
|
+
|
5
|
+
describe "Chatterbot::Skeleton" do
|
6
|
+
before(:each) do
|
7
|
+
@bot = Chatterbot::Bot.new
|
8
|
+
@bot.config = {
|
9
|
+
:consumer_key => "consumer_key",
|
10
|
+
:consumer_secret => "consumer_secret",
|
11
|
+
:secret => "secret",
|
12
|
+
:token => "token"
|
13
|
+
}
|
14
|
+
@bot.stub!(:botname).and_return("Skelley_The_Skeleton")
|
15
|
+
|
16
|
+
@output = Chatterbot::Skeleton.generate(@bot)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have name" do
|
20
|
+
@output.should include("Skelley_The_Skeleton")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have auth info" do
|
24
|
+
@output.should include("'consumer_key'")
|
25
|
+
@output.should include("'consumer_secret'")
|
26
|
+
@output.should include("'secret'")
|
27
|
+
@output.should include("'token'")
|
28
|
+
end
|
29
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -43,6 +43,15 @@ def fake_replies(max_id = 100, result_count = 0, id_base = 0)
|
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
46
|
+
def fake_followers(count)
|
47
|
+
mock(Twitter::Client,
|
48
|
+
{
|
49
|
+
:credentials? => true,
|
50
|
+
:followers => 1.upto(count).collect { |i| fake_follower(i) }
|
51
|
+
}
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
46
55
|
def fake_tweet(index, id=0, as_object = false)
|
47
56
|
id = index if id <= 0
|
48
57
|
x = {
|
@@ -56,3 +65,7 @@ def fake_tweet(index, id=0, as_object = false)
|
|
56
65
|
|
57
66
|
as_object == true ? Twitter::Tweet.new(x) : x
|
58
67
|
end
|
68
|
+
|
69
|
+
def fake_follower(index=0)
|
70
|
+
Twitter::User.new(:id => index, :name => "Follower #{index}")
|
71
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'chatterbot/dsl'
|
5
|
+
|
6
|
+
#
|
7
|
+
# this is the script for the twitter bot %{name}
|
8
|
+
# generated on %{timestamp}
|
9
|
+
#
|
10
|
+
|
11
|
+
consumer_key '%{consumer_key}'
|
12
|
+
consumer_secret '%{consumer_secret}'
|
13
|
+
|
14
|
+
secret '%{secret}'
|
15
|
+
token '%{token}'
|
16
|
+
|
17
|
+
# remove this to send out tweets
|
18
|
+
debug_mode
|
19
|
+
|
20
|
+
# remove this to update the db
|
21
|
+
no_update
|
22
|
+
# remove this to get less output when running
|
23
|
+
verbose
|
24
|
+
|
25
|
+
# here's a list of users to ignore
|
26
|
+
blacklist "abc", "def"
|
27
|
+
|
28
|
+
# here's a list of things to exclude from searches
|
29
|
+
exclude "hi", "spammer", "junk"
|
30
|
+
|
31
|
+
search "keyword" do |tweet|
|
32
|
+
reply "Hey #USER# nice to meet you!", tweet
|
33
|
+
end
|
34
|
+
|
35
|
+
replies do |tweet|
|
36
|
+
reply "Yes #USER#, you are very kind to say that!", tweet
|
37
|
+
end
|
metadata
CHANGED
@@ -1,227 +1,179 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: chatterbot
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
- 6
|
10
|
-
version: 0.6.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Colin Mitchell
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
prerelease: false
|
22
|
-
name: activesupport
|
23
|
-
type: :runtime
|
24
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 17
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
- 11
|
34
|
-
version: 3.0.11
|
35
|
-
requirement: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
prerelease: false
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
38
14
|
name: redcarpet
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
39
20
|
type: :development
|
40
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - "="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 3
|
46
|
-
segments:
|
47
|
-
- 2
|
48
|
-
- 3
|
49
|
-
- 0
|
50
|
-
version: 2.3.0
|
51
|
-
requirement: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
prerelease: false
|
54
|
-
name: shoulda-matchers
|
55
|
-
type: :development
|
56
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - "="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
hash: 23
|
62
|
-
segments:
|
63
|
-
- 1
|
64
|
-
- 0
|
65
|
-
- 0
|
66
|
-
version: 1.0.0
|
67
|
-
requirement: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
21
|
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
70
28
|
name: oauth
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
71
34
|
type: :runtime
|
72
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ">="
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
hash: 3
|
78
|
-
segments:
|
79
|
-
- 0
|
80
|
-
version: "0"
|
81
|
-
requirement: *id004
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
35
|
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
84
42
|
name: twitter
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
- - ">="
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
hash: 47
|
92
|
-
segments:
|
93
|
-
- 4
|
94
|
-
- 4
|
95
|
-
- 0
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
96
47
|
version: 4.4.0
|
97
|
-
|
98
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
type: :runtime
|
99
49
|
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.4.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
100
56
|
name: launchy
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
- - ">="
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
hash: 15
|
108
|
-
segments:
|
109
|
-
- 2
|
110
|
-
- 1
|
111
|
-
- 2
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
112
61
|
version: 2.1.2
|
113
|
-
|
114
|
-
- !ruby/object:Gem::Dependency
|
62
|
+
type: :runtime
|
115
63
|
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.1.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
116
70
|
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
117
76
|
type: :development
|
118
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
119
|
-
none: false
|
120
|
-
requirements:
|
121
|
-
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
hash: 3
|
124
|
-
segments:
|
125
|
-
- 0
|
126
|
-
version: "0"
|
127
|
-
requirement: *id007
|
128
|
-
- !ruby/object:Gem::Dependency
|
129
77
|
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
130
84
|
name: shoulda
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
131
90
|
type: :development
|
132
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
133
|
-
none: false
|
134
|
-
requirements:
|
135
|
-
- - ">="
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
hash: 3
|
138
|
-
segments:
|
139
|
-
- 0
|
140
|
-
version: "0"
|
141
|
-
requirement: *id008
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
91
|
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
144
98
|
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
145
104
|
type: :development
|
146
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
|
-
requirements:
|
149
|
-
- - ">="
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
hash: 3
|
152
|
-
segments:
|
153
|
-
- 0
|
154
|
-
version: "0"
|
155
|
-
requirement: *id009
|
156
|
-
- !ruby/object:Gem::Dependency
|
157
105
|
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
158
112
|
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.14.1
|
159
118
|
type: :development
|
160
|
-
version_requirements: &id010 !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ">="
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
hash: 63
|
166
|
-
segments:
|
167
|
-
- 2
|
168
|
-
- 12
|
169
|
-
- 0
|
170
|
-
version: 2.12.0
|
171
|
-
requirement: *id010
|
172
|
-
- !ruby/object:Gem::Dependency
|
173
119
|
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.14.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
174
126
|
name: rdoc
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
175
132
|
type: :development
|
176
|
-
version_requirements: &id011 !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
|
-
requirements:
|
179
|
-
- - ">="
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
hash: 3
|
182
|
-
segments:
|
183
|
-
- 0
|
184
|
-
version: "0"
|
185
|
-
requirement: *id011
|
186
|
-
- !ruby/object:Gem::Dependency
|
187
133
|
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
188
140
|
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
189
146
|
type: :development
|
190
|
-
version_requirements: &id012 !ruby/object:Gem::Requirement
|
191
|
-
none: false
|
192
|
-
requirements:
|
193
|
-
- - ">="
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
hash: 3
|
196
|
-
segments:
|
197
|
-
- 0
|
198
|
-
version: "0"
|
199
|
-
requirement: *id012
|
200
|
-
- !ruby/object:Gem::Dependency
|
201
147
|
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
202
154
|
name: watchr
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
203
160
|
type: :development
|
204
|
-
|
205
|
-
|
206
|
-
requirements:
|
207
|
-
- -
|
208
|
-
- !ruby/object:Gem::Version
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
version: "0"
|
213
|
-
requirement: *id013
|
214
|
-
description: A ruby framework for writing bots that run on Twitter. Comes with a simple DSL for easy coding.
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: A ruby framework for writing bots that run on Twitter. Comes with a simple
|
168
|
+
DSL for easy coding.
|
215
169
|
email: colin@muffinlabs.com
|
216
|
-
executables:
|
170
|
+
executables:
|
217
171
|
- chatterbot-blacklist
|
218
172
|
- chatterbot-register
|
219
173
|
- chatterbot-status
|
220
174
|
extensions: []
|
221
|
-
|
222
175
|
extra_rdoc_files: []
|
223
|
-
|
224
|
-
files:
|
176
|
+
files:
|
225
177
|
- .document
|
226
178
|
- .gitignore
|
227
179
|
- .travis.yml
|
@@ -247,11 +199,13 @@ files:
|
|
247
199
|
- lib/chatterbot/config.rb
|
248
200
|
- lib/chatterbot/db.rb
|
249
201
|
- lib/chatterbot/dsl.rb
|
202
|
+
- lib/chatterbot/followers.rb
|
250
203
|
- lib/chatterbot/helpers.rb
|
251
204
|
- lib/chatterbot/logging.rb
|
252
205
|
- lib/chatterbot/reply.rb
|
253
206
|
- lib/chatterbot/retweet.rb
|
254
207
|
- lib/chatterbot/search.rb
|
208
|
+
- lib/chatterbot/skeleton.rb
|
255
209
|
- lib/chatterbot/tweet.rb
|
256
210
|
- lib/chatterbot/ui.rb
|
257
211
|
- lib/chatterbot/version.rb
|
@@ -261,47 +215,40 @@ files:
|
|
261
215
|
- spec/config_spec.rb
|
262
216
|
- spec/db_spec.rb
|
263
217
|
- spec/dsl_spec.rb
|
218
|
+
- spec/followers_spec.rb
|
264
219
|
- spec/helpers_spec.rb
|
265
220
|
- spec/logging_spec.rb
|
266
221
|
- spec/reply_spec.rb
|
267
222
|
- spec/retweet_spec.rb
|
268
223
|
- spec/search_spec.rb
|
224
|
+
- spec/skeleton_spec.rb
|
269
225
|
- spec/spec_helper.rb
|
270
226
|
- spec/tweet_spec.rb
|
271
227
|
- specs.watchr
|
228
|
+
- templates/skeleton.txt
|
272
229
|
homepage: http://github.com/muffinista/chatterbot
|
273
|
-
licenses:
|
230
|
+
licenses:
|
274
231
|
- WTFDBAL
|
232
|
+
metadata: {}
|
275
233
|
post_install_message:
|
276
234
|
rdoc_options: []
|
277
|
-
|
278
|
-
require_paths:
|
235
|
+
require_paths:
|
279
236
|
- lib
|
280
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
none: false
|
291
|
-
requirements:
|
292
|
-
- - ">="
|
293
|
-
- !ruby/object:Gem::Version
|
294
|
-
hash: 3
|
295
|
-
segments:
|
296
|
-
- 0
|
297
|
-
version: "0"
|
237
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
238
|
+
requirements:
|
239
|
+
- - '>='
|
240
|
+
- !ruby/object:Gem::Version
|
241
|
+
version: '0'
|
242
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
|
+
requirements:
|
244
|
+
- - '>='
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: '0'
|
298
247
|
requirements: []
|
299
|
-
|
300
248
|
rubyforge_project: chatterbot
|
301
|
-
rubygems_version:
|
249
|
+
rubygems_version: 2.0.3
|
302
250
|
signing_key:
|
303
|
-
specification_version:
|
251
|
+
specification_version: 4
|
304
252
|
summary: A ruby framework for writing Twitter bots
|
305
253
|
test_files: []
|
306
|
-
|
307
254
|
has_rdoc:
|