chatterbot 2.0.3 → 2.0.4
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/.travis.yml +3 -5
- data/Gemfile +9 -17
- data/Rakefile +2 -18
- data/chatterbot.gemspec +10 -11
- data/docs/Gemfile +3 -0
- data/docs/README.md +3 -0
- data/docs/_config.yml +37 -0
- data/docs/_includes/footer.html +3 -0
- data/docs/_includes/header.html +4 -0
- data/docs/_includes/navigation.html +23 -0
- data/docs/_layouts/default.html +98 -0
- data/docs/_layouts/page.html +11 -0
- data/docs/_posts/.gitkeep +0 -0
- data/docs/_site/Gemfile +3 -0
- data/docs/_site/advanced.html +476 -0
- data/docs/_site/configuration.html +456 -0
- data/docs/_site/contributing.html +433 -0
- data/docs/_site/css/main.css +58 -0
- data/docs/_site/css/syntax.css +61 -0
- data/docs/_site/deploying.html +468 -0
- data/docs/_site/examples.html +574 -0
- data/docs/_site/features.html +497 -0
- data/docs/_site/images/01-create-application.png +0 -0
- data/docs/_site/images/02-application-permissions.png +0 -0
- data/docs/_site/images/03-mobile-number.png +0 -0
- data/docs/_site/images/04-access-token.png +0 -0
- data/docs/_site/index.html +482 -0
- data/docs/_site/javascripts/main.js +1 -0
- data/docs/_site/other-tools.html +438 -0
- data/docs/_site/params.json +1 -0
- data/docs/_site/rdoc.html +428 -0
- data/docs/_site/setup.html +500 -0
- data/docs/_site/streaming.html +506 -0
- data/docs/_site/stylesheets/pygment_trac.css +68 -0
- data/docs/_site/stylesheets/stylesheet.css +247 -0
- data/docs/_site/tut.html +422 -0
- data/docs/_site/twitter-docs.html +428 -0
- data/docs/_site/walkthrough.html +463 -0
- data/docs/advanced.md +67 -0
- data/docs/basics.md +12 -0
- data/docs/bin/jekyll-page +109 -0
- data/docs/configuration.md +32 -0
- data/docs/contributing.md +14 -0
- data/docs/css/main.css +58 -0
- data/docs/css/syntax.css +61 -0
- data/docs/deploying.md +53 -0
- data/docs/examples.md +168 -0
- data/docs/features.md +88 -0
- data/docs/images/01-create-application.png +0 -0
- data/docs/images/02-application-permissions.png +0 -0
- data/docs/images/03-mobile-number.png +0 -0
- data/docs/images/04-access-token.png +0 -0
- data/docs/index.md +70 -0
- data/docs/javascripts/main.js +1 -0
- data/docs/other-tools.md +17 -0
- data/docs/params.json +1 -0
- data/docs/rdoc.md +6 -0
- data/docs/setup.md +84 -0
- data/docs/streaming.md +98 -0
- data/docs/stylesheets/pygment_trac.css +68 -0
- data/docs/stylesheets/stylesheet.css +247 -0
- data/docs/tips.md +22 -0
- data/docs/tut.md +6 -0
- data/docs/twitter-docs.md +6 -0
- data/docs/walkthrough.md +46 -0
- data/examples/streaming_bot.rb +11 -10
- data/ext/mkrf_conf.rb +28 -0
- data/lib/chatterbot/bot.rb +5 -1
- data/lib/chatterbot/config.rb +1 -1
- data/lib/chatterbot/home_timeline.rb +1 -1
- data/lib/chatterbot/streaming.rb +11 -1
- data/lib/chatterbot/version.rb +1 -1
- data/spec/spec_helper.rb +1 -4
- metadata +71 -122
- data/examples/tweet_logger.rb +0 -68
@@ -0,0 +1,500 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
6
|
+
<meta name="viewport" content="width=device-width">
|
7
|
+
|
8
|
+
<title>chatterbot : Authorizing Your Bot</title>
|
9
|
+
<meta name="description" content="twitter bots in ruby">
|
10
|
+
|
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">
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
|
17
|
+
<div class="container">
|
18
|
+
<div class=row-fluid>
|
19
|
+
<div id=header class=span12>
|
20
|
+
<h4><a class=brand href="/">chatterbot</a>
|
21
|
+
<small>twitter bots in ruby</small>
|
22
|
+
</h4>
|
23
|
+
|
24
|
+
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class=row-fluid>
|
29
|
+
|
30
|
+
|
31
|
+
<div id=navigation class=span2>
|
32
|
+
<ul class="nav nav-list">
|
33
|
+
<li><a href="/">Home</a></li>
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
<li class=nav-header>Getting Started</li>
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<li data-order="">
|
58
|
+
|
59
|
+
<a href="/examples.html">Examples</a>
|
60
|
+
|
61
|
+
</li>
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
<li data-order="">
|
84
|
+
|
85
|
+
<a href="/setup.html">Authorizing Your Bot</a>
|
86
|
+
|
87
|
+
</li>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<li data-order="">
|
106
|
+
|
107
|
+
<a href="/walkthrough.html">Walkthrough</a>
|
108
|
+
|
109
|
+
</li>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<li class=nav-header>Documentation</li>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<li data-order="">
|
121
|
+
|
122
|
+
<a href="/advanced.html">Advanced Features</a>
|
123
|
+
|
124
|
+
</li>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<li data-order="">
|
131
|
+
|
132
|
+
<a href="/configuration.html">Configuration</a>
|
133
|
+
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<li data-order="">
|
145
|
+
|
146
|
+
<a href="/deploying.html">Running your Bot</a>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<li data-order="">
|
159
|
+
|
160
|
+
<a href="/features.html">Basic Features</a>
|
161
|
+
|
162
|
+
</li>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<li data-order="">
|
185
|
+
|
186
|
+
<a href="/streaming.html">Streaming API</a>
|
187
|
+
|
188
|
+
</li>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<li class=nav-header>Developers</li>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<li data-order="">
|
220
|
+
|
221
|
+
<a href="/contributing.html">Contributing</a>
|
222
|
+
|
223
|
+
</li>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
<li class=nav-header>Resources</li>
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
<li data-order="">
|
307
|
+
|
308
|
+
<a href="/other-tools.html">Other Tools</a>
|
309
|
+
|
310
|
+
</li>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
<li data-order="">
|
317
|
+
|
318
|
+
<a href="http://rubydoc.info/gems/chatterbot">rdoc</a>
|
319
|
+
|
320
|
+
</li>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
<li data-order="">
|
339
|
+
|
340
|
+
<a href="https://dev.twitter.com/rest/public">Twitter API docs</a>
|
341
|
+
|
342
|
+
</li>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<!-- List additional links. It is recommended to add a divider
|
352
|
+
e.g. <li class=divider></li> first to break up the content. -->
|
353
|
+
</ul>
|
354
|
+
|
355
|
+
</div>
|
356
|
+
|
357
|
+
<div id=content class=span10>
|
358
|
+
<div class=page-header>
|
359
|
+
<h2>Authorizing Your Bot
|
360
|
+
|
361
|
+
</h2>
|
362
|
+
</div>
|
363
|
+
|
364
|
+
<p>Getting a bot running on Twitter can be a little tricky. Twitter uses
|
365
|
+
a something called <a href="https://dev.twitter.com/oauth">OAuth</a> to validate
|
366
|
+
requests, but it's a little more complicated than just specifying a
|
367
|
+
username/password.</p>
|
368
|
+
|
369
|
+
<ul>
|
370
|
+
<li><p>Login to Twitter with your bot account</p></li>
|
371
|
+
<li><p>Go to <a href="https://apps.twitter.com/app/new">https://apps.twitter.com/app/new</a></p></li>
|
372
|
+
<li><p>Fill out the form. You need to put a name, description, and Website
|
373
|
+
URL, although the URL doesn't need to exist. <img
|
374
|
+
src="/images/01-create-application.png" /></p></li>
|
375
|
+
<li><p>Save the form, and then click on the Permissions tab. You will need
|
376
|
+
to specify what level of access is needed for your bot. <img
|
377
|
+
src="/images/02-application-permissions.png" /> You have three
|
378
|
+
choices here: Read only, Read and Write, and Read and Write and
|
379
|
+
access DMs. If your bot isn't actually ever going to post to Twitter
|
380
|
+
(for example, if you're just running a search to find interesting
|
381
|
+
tweets), you can choose read-only. Otherwise, you should pick
|
382
|
+
read/write, or read/write/DMs. Chatterbot has limited support for
|
383
|
+
handling Direct Messages, but if you can imagine a situation where
|
384
|
+
you might want to handle them, you should pick this option.</p></li>
|
385
|
+
<li><p><em>NOTE:</em> When you try and save this form, there's a good chance that
|
386
|
+
you will get an error that tells you to add a mobile phone to your Twitter
|
387
|
+
profile. It will look a lot like this: <img src="/images/03-mobile-number.png" /></p></li>
|
388
|
+
</ul>
|
389
|
+
|
390
|
+
<p>You can add your number here: <a href="https://twitter.com/settings/devices">https://twitter.com/settings/devices</a></p>
|
391
|
+
|
392
|
+
<p>After you add the number, Twitter will ask you to send them a text
|
393
|
+
message. Once you do this, you can finish updating the settings for
|
394
|
+
your application. Later, we'll remove the mobile number.</p>
|
395
|
+
|
396
|
+
<p>Once you've registered your application, you have two options. You can
|
397
|
+
create access tokens for your bot via Twitter, or you can run the
|
398
|
+
<code>chatterbot-register</code> script. Running the script will take care of
|
399
|
+
creating a template file for your bot, but if you don't want to do
|
400
|
+
that, here are the steps for doing this manually:</p>
|
401
|
+
|
402
|
+
<ul>
|
403
|
+
<li> click the 'Keys and Access Tokens' link. You should see this: <img src="/images/04-access-token.png" /></li>
|
404
|
+
<li>click the 'Create my access token' link. </li>
|
405
|
+
<li>It might take a few minutes for Twitter to actually generate the
|
406
|
+
token. You can refresh the page a couple times until they are there,
|
407
|
+
then you can copy the keys into your application. There's four keys
|
408
|
+
you will need for your bot, and a couple different ways to save
|
409
|
+
them:</li>
|
410
|
+
</ul>
|
411
|
+
|
412
|
+
<p><strong>In a separate YAML config file</strong>. Create a file named botname.yaml
|
413
|
+
-- the botname part must match your bot's username EXACTLY. Put the
|
414
|
+
following contents, pasting the credential values that you just
|
415
|
+
generated:</p>
|
416
|
+
<div class="highlight"><pre><code class="language-text" data-lang="text"> ---
|
417
|
+
:consumer_secret: Consumer Secret (API Secret) GOES HERE
|
418
|
+
:consumer_key: Consumer Key (API Key) GOES HERE
|
419
|
+
:token: Access Token GOES HERE
|
420
|
+
:secret: Access Token Secret GOES HERE
|
421
|
+
</code></pre></div>
|
422
|
+
<p><strong>in the script</strong>. Add some lines to your bot script like this:
|
423
|
+
<code>
|
424
|
+
consumer_key 'Consumer Secret (API Secret)'
|
425
|
+
consumer_secret 'Consumer Key (API Key)'
|
426
|
+
secret 'Access Token Secret'
|
427
|
+
token 'Access Token'
|
428
|
+
</code></p>
|
429
|
+
|
430
|
+
<p><strong>in a database</strong>. If you've setup chatterbot to use a database, you
|
431
|
+
can store your configuration info in the <strong>config</strong> table.</p>
|
432
|
+
|
433
|
+
<p><strong>NOTE</strong> At this point, you can remove the phone number from the bot
|
434
|
+
account if you like. From your bot's account, click 'Settings' ->
|
435
|
+
'Mobile' -> 'Delete my phone'.</p>
|
436
|
+
|
437
|
+
|
438
|
+
</div>
|
439
|
+
|
440
|
+
</div>
|
441
|
+
|
442
|
+
<div class=row-fluid>
|
443
|
+
<div id=footer class=span12>
|
444
|
+
Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
|
445
|
+
|
446
|
+
</div>
|
447
|
+
</div>
|
448
|
+
</div>
|
449
|
+
|
450
|
+
<script>
|
451
|
+
function orderNav() {
|
452
|
+
var list,
|
453
|
+
section,
|
454
|
+
header,
|
455
|
+
sections = [],
|
456
|
+
lists = {},
|
457
|
+
headers = {};
|
458
|
+
|
459
|
+
var navUl = document.querySelectorAll('#navigation ul')[0],
|
460
|
+
navLis = document.querySelectorAll('#navigation ul li');
|
461
|
+
|
462
|
+
if (!navUl) return;
|
463
|
+
|
464
|
+
for (var i = 0; i < navLis.length; i++) {
|
465
|
+
var order, li = navLis[i];
|
466
|
+
|
467
|
+
if (li.classList.contains('nav-header')) {
|
468
|
+
section = li.textContent || li.innerText;
|
469
|
+
sections.push(section);
|
470
|
+
headers[section] = li;
|
471
|
+
continue;
|
472
|
+
}
|
473
|
+
|
474
|
+
if (!lists[section]) {
|
475
|
+
lists[section] = [];
|
476
|
+
}
|
477
|
+
|
478
|
+
order = parseFloat(li.getAttribute('data-order'))
|
479
|
+
lists[section].push([order, li]);
|
480
|
+
}
|
481
|
+
|
482
|
+
for (var i = 0; i < sections.length; i++) {
|
483
|
+
section = sections[i];
|
484
|
+
list = lists[section].sort(function(a, b) {
|
485
|
+
return a[0] - b[0];
|
486
|
+
});
|
487
|
+
|
488
|
+
if (header = headers[section]) {
|
489
|
+
navUl.appendChild(header);
|
490
|
+
}
|
491
|
+
for (var j = 0; j < list.length; j++) {
|
492
|
+
navUl.appendChild(list[j][1]);
|
493
|
+
}
|
494
|
+
}
|
495
|
+
}
|
496
|
+
|
497
|
+
if (document.querySelectorAll) orderNav();
|
498
|
+
</script>
|
499
|
+
</body>
|
500
|
+
</html>
|