chatterbot 2.0.5 → 2.1.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 +5 -5
- data/.github/workflows/ci.yml +19 -0
- data/Gemfile +2 -2
- data/README.markdown +7 -21
- data/chatterbot.gemspec +3 -3
- data/docs/_site/advanced.html +43 -54
- data/docs/_site/configuration.html +23 -43
- data/docs/_site/contributing.html +18 -37
- data/docs/_site/deploying.html +44 -61
- data/docs/_site/examples.html +108 -123
- data/docs/_site/features.html +70 -71
- data/docs/_site/index.html +43 -64
- data/docs/_site/other-tools.html +22 -41
- data/docs/_site/rdoc.html +17 -36
- data/docs/_site/setup.html +62 -71
- data/docs/_site/tut.html +16 -36
- data/docs/_site/twitter-docs.html +17 -36
- data/docs/_site/walkthrough.html +35 -51
- data/docs/advanced.md +0 -5
- data/docs/deploying.md +0 -6
- data/docs/examples.md +0 -48
- data/docs/index.md +2 -3
- data/lib/chatterbot.rb +0 -1
- data/lib/chatterbot/bot.rb +5 -68
- data/lib/chatterbot/client.rb +2 -9
- data/lib/chatterbot/config.rb +0 -1
- data/lib/chatterbot/dsl.rb +0 -43
- data/lib/chatterbot/skeleton.rb +0 -2
- data/lib/chatterbot/version.rb +1 -1
- data/spec/bot_spec.rb +1 -76
- data/spec/client_spec.rb +0 -3
- data/spec/config_manager_spec.rb +6 -5
- data/spec/config_spec.rb +4 -1
- data/spec/dsl_spec.rb +1 -33
- data/templates/skeleton.txt +0 -47
- metadata +13 -21
- data/.document +0 -5
- data/.travis.yml +0 -9
- data/docs/_site/streaming.html +0 -506
- data/docs/streaming.md +0 -98
- data/examples/streaming_bot.rb +0 -49
- data/lib/chatterbot/streaming.rb +0 -72
- data/spec/streaming_spec.rb +0 -172
data/docs/_site/features.html
CHANGED
@@ -9,15 +9,15 @@
|
|
9
9
|
<meta name="description" content="twitter bots in ruby">
|
10
10
|
|
11
11
|
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
|
12
|
-
<link rel="stylesheet" href="/css/syntax.css">
|
13
|
-
<link rel="stylesheet" href="/css/main.css">
|
12
|
+
<link rel="stylesheet" href="/chatterbot/css/syntax.css">
|
13
|
+
<link rel="stylesheet" href="/chatterbot/css/main.css">
|
14
14
|
</head>
|
15
15
|
<body>
|
16
16
|
|
17
17
|
<div class="container">
|
18
18
|
<div class=row-fluid>
|
19
19
|
<div id=header class=span12>
|
20
|
-
<h4><a class=brand href="/">chatterbot</a>
|
20
|
+
<h4><a class=brand href="/chatterbot/">chatterbot</a>
|
21
21
|
<small>twitter bots in ruby</small>
|
22
22
|
</h4>
|
23
23
|
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
<div id=navigation class=span2>
|
32
32
|
<ul class="nav nav-list">
|
33
|
-
<li><a href="/">Home</a></li>
|
33
|
+
<li><a href="/chatterbot/">Home</a></li>
|
34
34
|
|
35
35
|
|
36
36
|
|
@@ -56,7 +56,7 @@
|
|
56
56
|
|
57
57
|
<li data-order="">
|
58
58
|
|
59
|
-
<a href="/examples.html">Examples</a>
|
59
|
+
<a href="/chatterbot/examples.html">Examples</a>
|
60
60
|
|
61
61
|
</li>
|
62
62
|
|
@@ -82,7 +82,7 @@
|
|
82
82
|
|
83
83
|
<li data-order="">
|
84
84
|
|
85
|
-
<a href="/setup.html">Authorizing Your Bot</a>
|
85
|
+
<a href="/chatterbot/setup.html">Authorizing Your Bot</a>
|
86
86
|
|
87
87
|
</li>
|
88
88
|
|
@@ -97,14 +97,10 @@
|
|
97
97
|
|
98
98
|
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
100
|
|
105
101
|
<li data-order="">
|
106
102
|
|
107
|
-
<a href="/walkthrough.html">Walkthrough</a>
|
103
|
+
<a href="/chatterbot/walkthrough.html">Walkthrough</a>
|
108
104
|
|
109
105
|
</li>
|
110
106
|
|
@@ -119,7 +115,7 @@
|
|
119
115
|
|
120
116
|
<li data-order="">
|
121
117
|
|
122
|
-
<a href="/advanced.html">Advanced Features</a>
|
118
|
+
<a href="/chatterbot/advanced.html">Advanced Features</a>
|
123
119
|
|
124
120
|
</li>
|
125
121
|
|
@@ -129,7 +125,7 @@
|
|
129
125
|
|
130
126
|
<li data-order="">
|
131
127
|
|
132
|
-
<a href="/configuration.html">Configuration</a>
|
128
|
+
<a href="/chatterbot/configuration.html">Configuration</a>
|
133
129
|
|
134
130
|
</li>
|
135
131
|
|
@@ -143,7 +139,7 @@
|
|
143
139
|
|
144
140
|
<li data-order="">
|
145
141
|
|
146
|
-
<a href="/deploying.html">Running your Bot</a>
|
142
|
+
<a href="/chatterbot/deploying.html">Running your Bot</a>
|
147
143
|
|
148
144
|
</li>
|
149
145
|
|
@@ -157,7 +153,7 @@
|
|
157
153
|
|
158
154
|
<li data-order="">
|
159
155
|
|
160
|
-
<a href="/features.html">Basic Features</a>
|
156
|
+
<a href="/chatterbot/features.html">Basic Features</a>
|
161
157
|
|
162
158
|
</li>
|
163
159
|
|
@@ -180,16 +176,6 @@
|
|
180
176
|
|
181
177
|
|
182
178
|
|
183
|
-
|
184
|
-
<li data-order="">
|
185
|
-
|
186
|
-
<a href="/streaming.html">Streaming API</a>
|
187
|
-
|
188
|
-
</li>
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
179
|
|
194
180
|
|
195
181
|
|
@@ -218,7 +204,7 @@
|
|
218
204
|
|
219
205
|
<li data-order="">
|
220
206
|
|
221
|
-
<a href="/contributing.html">Contributing</a>
|
207
|
+
<a href="/chatterbot/contributing.html">Contributing</a>
|
222
208
|
|
223
209
|
</li>
|
224
210
|
|
@@ -259,10 +245,6 @@
|
|
259
245
|
|
260
246
|
|
261
247
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
248
|
|
267
249
|
|
268
250
|
|
@@ -305,7 +287,7 @@
|
|
305
287
|
|
306
288
|
<li data-order="">
|
307
289
|
|
308
|
-
<a href="/other-tools.html">Other Tools</a>
|
290
|
+
<a href="/chatterbot/other-tools.html">Other Tools</a>
|
309
291
|
|
310
292
|
</li>
|
311
293
|
|
@@ -330,10 +312,6 @@
|
|
330
312
|
|
331
313
|
|
332
314
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
315
|
|
338
316
|
<li data-order="">
|
339
317
|
|
@@ -361,65 +339,84 @@
|
|
361
339
|
</h2>
|
362
340
|
</div>
|
363
341
|
|
364
|
-
<p>Here
|
342
|
+
<p>Here’s a list of some of the commonly-used methods in the Chatterbot DSL:</p>
|
343
|
+
|
344
|
+
<p><strong>search</strong> – You can use this to perform a search on Twitter:</p>
|
365
345
|
|
366
|
-
<
|
367
|
-
|
368
|
-
reply "#USER# I am serious, and don't call me Shirley!", tweet
|
346
|
+
<pre><code>search("'surely you must be joking'") do |tweet|
|
347
|
+
reply "#USER# I am serious, and don't call me Shirley!", tweet
|
369
348
|
end
|
370
|
-
</code></pre
|
349
|
+
</code></pre>
|
350
|
+
|
371
351
|
<p>By default, Chatterbot keeps track of the last time you ran the bot,
|
372
352
|
and it will only search for new tweets.</p>
|
373
353
|
|
374
|
-
<p><strong>replies</strong>
|
375
|
-
|
376
|
-
|
354
|
+
<p><strong>replies</strong> – Use this to check for replies and mentions:</p>
|
355
|
+
|
356
|
+
<pre><code>replies do |tweet|
|
357
|
+
reply "#USER# Thanks for contacting me!", tweet
|
377
358
|
end
|
378
|
-
</code></pre
|
359
|
+
</code></pre>
|
360
|
+
|
379
361
|
<p>Note that the string <strong>#USER#</strong> is automatically replaced with the
|
380
362
|
username of the person who sent the original tweet. Also, Chatterbot
|
381
363
|
will only return tweets that were sent since the last run of the bot.</p>
|
382
364
|
|
383
|
-
<p><strong>tweet</strong>
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
</
|
389
|
-
|
390
|
-
<
|
391
|
-
|
392
|
-
|
393
|
-
</
|
394
|
-
|
365
|
+
<p><strong>tweet</strong> – send a Tweet out for this bot:</p>
|
366
|
+
|
367
|
+
<pre><code>tweet "I AM A BOT!!!"
|
368
|
+
</code></pre>
|
369
|
+
|
370
|
+
<p><strong>reply</strong> – reply to another tweet:</p>
|
371
|
+
|
372
|
+
<pre><code>reply "THIS IS A REPLY TO #USER#!", original_tweet
|
373
|
+
</code></pre>
|
374
|
+
|
375
|
+
<p><strong>retweet</strong> – Chatterbot can retweet tweets as well:</p>
|
376
|
+
|
377
|
+
<p><code>rb
|
378
|
+
search "xyzzy" do |tweet|
|
379
|
+
retweet(tweet[:id])
|
380
|
+
end
|
381
|
+
</code></p>
|
382
|
+
|
383
|
+
<p><strong>blacklist</strong> – you can use this to specify a list of users you don’t
|
395
384
|
want to interact with. If you put the following line at the top of
|
396
385
|
your bot:</p>
|
397
|
-
|
398
|
-
|
386
|
+
|
387
|
+
<pre><code>blacklist "user1, user2, user3"
|
388
|
+
</code></pre>
|
389
|
+
|
399
390
|
<p>None of those users will trigger your bot if they come up in a
|
400
391
|
search. However, if a user replies to one of your tweets or mentions
|
401
392
|
your bot in a tweet, you will still receive that tweet when checking
|
402
393
|
for replies.</p>
|
403
394
|
|
404
|
-
<p><strong>exclude</strong>
|
405
|
-
which shouldn
|
406
|
-
|
407
|
-
|
408
|
-
|
395
|
+
<p><strong>exclude</strong> – similarly, you can specify a list of words/phrases
|
396
|
+
which shouldn’t trigger your bot. If you use the following:</p>
|
397
|
+
|
398
|
+
<pre><code>exclude "spam"
|
399
|
+
</code></pre>
|
400
|
+
|
401
|
+
<p>Any tweets or mentions with the word ‘spam’ in them will be ignored by
|
409
402
|
the bot. If you wanted to ignore any tweets with links in them (a wise
|
410
403
|
precaution if you want to avoid spreading spam), you could call:</p>
|
411
|
-
|
412
|
-
|
413
|
-
|
404
|
+
|
405
|
+
<pre><code>exclude "http://"
|
406
|
+
</code></pre>
|
407
|
+
|
408
|
+
<p>The library actually comes with a pre-defined list of ‘bad words’
|
414
409
|
which you can exclude by default by calling:</p>
|
415
|
-
|
416
|
-
|
417
|
-
|
410
|
+
|
411
|
+
<pre><code>exclude bad_words
|
412
|
+
</code></pre>
|
413
|
+
|
414
|
+
<p>The word list is from Darius Kazemi’s
|
418
415
|
<a href="https://github.com/dariusk/wordfilter">wordfilter</a>.</p>
|
419
416
|
|
420
417
|
<p><strong>whitelist</strong></p>
|
421
418
|
|
422
|
-
<p><strong>followers</strong>
|
419
|
+
<p><strong>followers</strong> – get a list of your followers. This is an experimental
|
423
420
|
feature but should work for most purposes.</p>
|
424
421
|
|
425
422
|
<p><strong>follow</strong></p>
|
@@ -438,7 +435,9 @@ in the source code.</p>
|
|
438
435
|
|
439
436
|
<div class=row-fluid>
|
440
437
|
<div id=footer class=span12>
|
441
|
-
|
438
|
+
<!--
|
439
|
+
Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
|
440
|
+
-->
|
442
441
|
|
443
442
|
</div>
|
444
443
|
</div>
|
data/docs/_site/index.html
CHANGED
@@ -9,15 +9,15 @@
|
|
9
9
|
<meta name="description" content="twitter bots in ruby">
|
10
10
|
|
11
11
|
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
|
12
|
-
<link rel="stylesheet" href="/css/syntax.css">
|
13
|
-
<link rel="stylesheet" href="/css/main.css">
|
12
|
+
<link rel="stylesheet" href="/chatterbot/css/syntax.css">
|
13
|
+
<link rel="stylesheet" href="/chatterbot/css/main.css">
|
14
14
|
</head>
|
15
15
|
<body>
|
16
16
|
|
17
17
|
<div class="container">
|
18
18
|
<div class=row-fluid>
|
19
19
|
<div id=header class=span12>
|
20
|
-
<h4><a class=brand href="/">chatterbot</a>
|
20
|
+
<h4><a class=brand href="/chatterbot/">chatterbot</a>
|
21
21
|
<small>twitter bots in ruby</small>
|
22
22
|
</h4>
|
23
23
|
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
<div id=navigation class=span2>
|
32
32
|
<ul class="nav nav-list">
|
33
|
-
<li><a href="/">Home</a></li>
|
33
|
+
<li><a href="/chatterbot/">Home</a></li>
|
34
34
|
|
35
35
|
|
36
36
|
|
@@ -56,7 +56,7 @@
|
|
56
56
|
|
57
57
|
<li data-order="">
|
58
58
|
|
59
|
-
<a href="/examples.html">Examples</a>
|
59
|
+
<a href="/chatterbot/examples.html">Examples</a>
|
60
60
|
|
61
61
|
</li>
|
62
62
|
|
@@ -82,7 +82,7 @@
|
|
82
82
|
|
83
83
|
<li data-order="">
|
84
84
|
|
85
|
-
<a href="/setup.html">Authorizing Your Bot</a>
|
85
|
+
<a href="/chatterbot/setup.html">Authorizing Your Bot</a>
|
86
86
|
|
87
87
|
</li>
|
88
88
|
|
@@ -97,14 +97,10 @@
|
|
97
97
|
|
98
98
|
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
100
|
|
105
101
|
<li data-order="">
|
106
102
|
|
107
|
-
<a href="/walkthrough.html">Walkthrough</a>
|
103
|
+
<a href="/chatterbot/walkthrough.html">Walkthrough</a>
|
108
104
|
|
109
105
|
</li>
|
110
106
|
|
@@ -119,7 +115,7 @@
|
|
119
115
|
|
120
116
|
<li data-order="">
|
121
117
|
|
122
|
-
<a href="/advanced.html">Advanced Features</a>
|
118
|
+
<a href="/chatterbot/advanced.html">Advanced Features</a>
|
123
119
|
|
124
120
|
</li>
|
125
121
|
|
@@ -129,7 +125,7 @@
|
|
129
125
|
|
130
126
|
<li data-order="">
|
131
127
|
|
132
|
-
<a href="/configuration.html">Configuration</a>
|
128
|
+
<a href="/chatterbot/configuration.html">Configuration</a>
|
133
129
|
|
134
130
|
</li>
|
135
131
|
|
@@ -143,7 +139,7 @@
|
|
143
139
|
|
144
140
|
<li data-order="">
|
145
141
|
|
146
|
-
<a href="/deploying.html">Running your Bot</a>
|
142
|
+
<a href="/chatterbot/deploying.html">Running your Bot</a>
|
147
143
|
|
148
144
|
</li>
|
149
145
|
|
@@ -157,7 +153,7 @@
|
|
157
153
|
|
158
154
|
<li data-order="">
|
159
155
|
|
160
|
-
<a href="/features.html">Basic Features</a>
|
156
|
+
<a href="/chatterbot/features.html">Basic Features</a>
|
161
157
|
|
162
158
|
</li>
|
163
159
|
|
@@ -180,16 +176,6 @@
|
|
180
176
|
|
181
177
|
|
182
178
|
|
183
|
-
|
184
|
-
<li data-order="">
|
185
|
-
|
186
|
-
<a href="/streaming.html">Streaming API</a>
|
187
|
-
|
188
|
-
</li>
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
179
|
|
194
180
|
|
195
181
|
|
@@ -218,7 +204,7 @@
|
|
218
204
|
|
219
205
|
<li data-order="">
|
220
206
|
|
221
|
-
<a href="/contributing.html">Contributing</a>
|
207
|
+
<a href="/chatterbot/contributing.html">Contributing</a>
|
222
208
|
|
223
209
|
</li>
|
224
210
|
|
@@ -259,10 +245,6 @@
|
|
259
245
|
|
260
246
|
|
261
247
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
248
|
|
267
249
|
|
268
250
|
|
@@ -305,7 +287,7 @@
|
|
305
287
|
|
306
288
|
<li data-order="">
|
307
289
|
|
308
|
-
<a href="/other-tools.html">Other Tools</a>
|
290
|
+
<a href="/chatterbot/other-tools.html">Other Tools</a>
|
309
291
|
|
310
292
|
</li>
|
311
293
|
|
@@ -330,10 +312,6 @@
|
|
330
312
|
|
331
313
|
|
332
314
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
315
|
|
338
316
|
<li data-order="">
|
339
317
|
|
@@ -357,65 +335,64 @@
|
|
357
335
|
<div id=content class=span10>
|
358
336
|
<h1 id="chatterbot">Chatterbot</h1>
|
359
337
|
|
360
|
-
<p>Chatterbot is a Ruby library for making bots on Twitter. It
|
338
|
+
<p><a href="https://github.com/muffinista/chatterbot">Chatterbot</a> is a Ruby library for making bots on Twitter. It’s
|
361
339
|
great for rapid development of bot ideas. It handles all of the basic
|
362
|
-
Twitter API features
|
340
|
+
Twitter API features – searches, replies, tweets, retweets, etc. and has
|
363
341
|
a simple blacklist/whitelist system to help minimize spam and unwanted
|
364
342
|
data.</p>
|
365
343
|
|
366
344
|
<p>A bot using chatterbot can be as simple as this:</p>
|
367
|
-
<div class="highlight"><pre><code class="language-text" data-lang="text">exclude "http://"
|
368
|
-
blacklist "mean_user, private_user"
|
369
345
|
|
370
|
-
|
346
|
+
<p>```
|
347
|
+
exclude “http://”
|
348
|
+
blacklist “mean_user, private_user”</p>
|
349
|
+
|
350
|
+
<p>puts “checking my timeline”
|
371
351
|
home_timeline do |tweet|
|
372
352
|
# i like to favorite things
|
373
353
|
favorite tweet
|
374
|
-
end
|
354
|
+
end</p>
|
375
355
|
|
376
|
-
puts
|
356
|
+
<p>puts “checking for replies to my tweets and mentions of me”
|
377
357
|
replies do |tweet|
|
378
358
|
text = tweet.text
|
379
|
-
puts
|
380
|
-
src = text.gsub(/@echoes_bot/,
|
359
|
+
puts “message received: #{text}”
|
360
|
+
src = text.gsub(/@echoes_bot/, “#USER#”) </p>
|
381
361
|
|
382
|
-
|
362
|
+
<p># send it back!
|
383
363
|
reply src, tweet
|
384
364
|
end
|
385
|
-
|
365
|
+
```</p>
|
366
|
+
|
386
367
|
<p>Or you can write a bot using more traditional ruby classes.</p>
|
387
368
|
|
388
369
|
<p>Chatterbot can actually generate a template bot file for you, and will
|
389
370
|
walk you through process of getting a bot authorized with Twitter.</p>
|
390
371
|
|
391
372
|
<h2 id="features">Features</h2>
|
392
|
-
|
393
373
|
<ul>
|
394
|
-
<li>Handles search queries and replies to your bot</li>
|
395
|
-
<li>Use a simple scripting language, or extend a Bot class if you need it</li>
|
396
|
-
<li>Wraps the Twitter gem so you have access to the entire Twitter API</li>
|
397
|
-
<li>Simple blacklistling system to limit your annoyance of users</li>
|
398
|
-
<li>Avoid your bot making a fool of itself by ignoring tweets with
|
374
|
+
<li>Handles search queries and replies to your bot</li>
|
375
|
+
<li>Use a simple scripting language, or extend a Bot class if you need it</li>
|
376
|
+
<li>Wraps the Twitter gem so you have access to the entire Twitter API</li>
|
377
|
+
<li>Simple blacklistling system to limit your annoyance of users</li>
|
378
|
+
<li>Avoid your bot making a fool of itself by ignoring tweets with
|
399
379
|
certain bad words</li>
|
400
|
-
<li>Basic Streaming API support</li>
|
401
|
-
<li>Optionally log tweets to the database for metrics and tracking purposes</li>
|
380
|
+
<li>Basic Streaming API support</li>
|
381
|
+
<li>Optionally log tweets to the database for metrics and tracking purposes</li>
|
402
382
|
</ul>
|
403
383
|
|
404
384
|
<p>Chatterbot uses the the Twitter gem
|
405
|
-
(
|
385
|
+
(https://github.com/sferik/twitter) to handle the underlying API
|
406
386
|
calls. Any calls to the search/reply methods will return
|
407
387
|
<code>Twitter::Tweet</code> objects.</p>
|
408
388
|
|
409
|
-
<h2 id="
|
389
|
+
<h2 id="copyrightlicense">Copyright/License</h2>
|
390
|
+
|
391
|
+
<p>Copyright (c) 2014 Colin Mitchell. Chatterbot is distributed under the
|
392
|
+
WTFPL license.</p>
|
410
393
|
|
411
|
-
<p>
|
412
|
-
modified WTFPL licence -- it's the 'Do what the fuck you want to --
|
413
|
-
but don't be an asshole' public license. Please see LICENSE.txt for
|
414
|
-
further details. Basically, do whatever you want with this code, but
|
415
|
-
don't be an asshole about it. If you spam users inappropriately,
|
416
|
-
expect your karma to suffer.</p>
|
394
|
+
<p>http://muffinlabs.com</p>
|
417
395
|
|
418
|
-
<p><a href="http://muffinlabs.com">http://muffinlabs.com</a></p>
|
419
396
|
|
420
397
|
</div>
|
421
398
|
|
@@ -423,7 +400,9 @@ expect your karma to suffer.</p>
|
|
423
400
|
|
424
401
|
<div class=row-fluid>
|
425
402
|
<div id=footer class=span12>
|
426
|
-
|
403
|
+
<!--
|
404
|
+
Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
|
405
|
+
-->
|
427
406
|
|
428
407
|
</div>
|
429
408
|
</div>
|