chatterbot 2.0.5 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -364,17 +342,20 @@
364
342
  <p>Bug fixes, features, etc are eagerly welcomed. Since this code is
365
343
  being used to run current Twitter bots, any changes need to maintain
366
344
  compatibility. If there are bugs or things you would like to improve,
367
- fork the project and hack away. I&#39;ll pull anything back that makes
345
+ fork the project and hack away. Ill pull anything back that makes
368
346
  sense if requested.</p>
369
347
 
370
348
 
349
+
371
350
  </div>
372
351
 
373
352
  </div>
374
353
 
375
354
  <div class=row-fluid>
376
355
  <div id=footer class=span12>
377
- Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
356
+ <!--
357
+ Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
358
+ -->
378
359
 
379
360
  </div>
380
361
  </div>
@@ -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,46 +339,49 @@
361
339
  </h2>
362
340
  </div>
363
341
 
364
- <p>There&#39;s a couple ways of running your bot:</p>
342
+ <p>Theres a couple ways of running your bot:</p>
365
343
 
366
344
  <h2 id="manually">Manually</h2>
367
345
 
368
346
  <p>Run it on the command-line whenever you like. Whee!</p>
369
347
 
370
348
  <h2 id="cron">Cron</h2>
349
+ <p>Run it via cron. Here’s an example of running a bot every two minutes</p>
371
350
 
372
- <p>Run it via cron. Here&#39;s an example of running a bot every two minutes</p>
373
- <div class="highlight"><pre><code class="language-text" data-lang="text">*/2 * * * * . ~/.bash_profile; cd /path/to/bot/; ./bot.rb
374
- </code></pre></div>
375
- <h2 id="looping">Looping</h2>
351
+ <pre><code>*/2 * * * * . ~/.bash_profile; cd /path/to/bot/; ./bot.rb
352
+ </code></pre>
376
353
 
354
+ <h2 id="looping">Looping</h2>
377
355
  <p>Run it as a background process. Just put the guts of your bot in a loop like this:</p>
378
- <div class="highlight"><pre><code class="language-rb" data-lang="rb"><span class="kp">loop</span> <span class="k">do</span>
379
- <span class="n">search</span> <span class="s2">&quot;twitter&quot;</span> <span class="k">do</span> <span class="o">|</span><span class="n">tweet</span><span class="o">|</span>
380
- <span class="c1"># here you could do something with a tweet</span>
381
- <span class="c1"># if you want to retweet</span>
382
- <span class="n">retweet</span><span class="p">(</span><span class="n">tweet</span><span class="o">[</span><span class="ss">:id</span><span class="o">]</span><span class="p">)</span>
383
- <span class="k">end</span>
384
-
385
- <span class="n">replies</span> <span class="k">do</span> <span class="o">|</span><span class="n">tweet</span><span class="o">|</span>
386
- <span class="c1"># do stuff</span>
387
- <span class="k">end</span>
388
-
389
- <span class="c1"># explicitly update our config</span>
390
- <span class="n">update_config</span>
391
-
392
- <span class="nb">sleep</span> <span class="mi">60</span>
393
- <span class="k">end</span>
394
- </code></pre></div>
356
+
357
+ <p>```rb
358
+ loop do
359
+ search “twitter” do |tweet|
360
+ # here you could do something with a tweet
361
+ # if you want to retweet
362
+ retweet(tweet[:id])
363
+ end</p>
364
+
365
+ <p>replies do |tweet|
366
+ # do stuff
367
+ end</p>
368
+
369
+ <p># explicitly update our config
370
+ update_config</p>
371
+
372
+ <p>sleep 60
373
+ end
374
+ ```</p>
375
+
395
376
  <p><strong>NOTE:</strong> You need to call <code>update_config</code> to update the last tweet your script
396
- has processed -- if you don&#39;t have this call, you will get duplicate
377
+ has processed if you dont have this call, you will get duplicate
397
378
  tweets.</p>
398
379
 
399
380
  <h2 id="streaming">Streaming</h2>
400
381
 
401
382
  <p>Chatterbot has rough support for the Streaming API. If your bot can
402
- use it, it&#39;s a great option, because you get your data immediately.
403
- You can read more about setting up a bot to use <a href="/streaming.html">streaming</a>.</p>
383
+ use it, its a great option, because you get your data immediately.
384
+ You can read more about setting up a bot to use <a href="streaming.html">streaming</a>.</p>
404
385
 
405
386
 
406
387
  </div>
@@ -409,7 +390,9 @@ You can read more about setting up a bot to use <a href="/streaming.html">stream
409
390
 
410
391
  <div class=row-fluid>
411
392
  <div id=footer class=span12>
412
- Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
393
+ <!--
394
+ Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
395
+ -->
413
396
 
414
397
  </div>
415
398
  </div>
@@ -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,153 +339,158 @@
361
339
  </h2>
362
340
  </div>
363
341
 
364
- <p>Here&#39;s a couple examples of working bots.</p>
342
+ <p>Heres a couple examples of working bots.</p>
365
343
 
366
- <h2 id="@echoes_bot">@echoes_bot</h2>
344
+ <h2 id="echoesbot">@echoes_bot</h2>
367
345
 
368
346
  <p>This is a working bot. It responds to any mentions with the incoming
369
347
  text:</p>
370
348
 
371
349
  <blockquote class="twitter-tweet" lang="en"><p><a href="https://twitter.com/muffinista">@muffinista</a> hello there!</p>&mdash; Echo Echo (@echoes_bot) <a href="https://twitter.com/echoes_bot/status/515166110950256640">September 25, 2014</a></blockquote>
350
+ <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
372
351
 
373
- <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
352
+ <p>Here’s the code. This is right out of the git repo for chatterbot:</p>
374
353
 
375
- <p>Here&#39;s the code. This is right out of the git repo for chatterbot:</p>
376
- <div class="highlight"><pre><code class="language-text" data-lang="text">## This is a very simple working example of a bot you can build with
377
- ## chatterbot. It looks for mentions of &#39;@echoes_bot&#39; (the twitter
354
+ <p>```
355
+ ## This is a very simple working example of a bot you can build with
356
+ ## chatterbot. It looks for mentions of ‘@echoes_bot (the twitter
378
357
  ## handle the bot uses), and sends replies with the name switched to
379
- ## the handle of the sending user
358
+ ## the handle of the sending user</p>
380
359
 
381
- #
360
+ <p>#
382
361
  # require the dsl lib to include all the methods you see below.
383
362
  #
384
- require &#39;rubygems&#39;
385
- require &#39;chatterbot/dsl&#39;
363
+ require rubygems
364
+ require chatterbot/dsl’</p>
386
365
 
387
- puts &quot;Loading echoes_bot.rb&quot;
366
+ <p>puts Loading echoes_bot.rb”</p>
388
367
 
368
+ <h1 id="section">#</h1>
369
+ <p>## If I wanted to exclude some terms from triggering this bot, I would list them here.
370
+ ## For now, we’ll block URLs to keep this from being a source of spam
389
371
  ##
390
- ## If I wanted to exclude some terms from triggering this bot, I would list them here.
391
- ## For now, we&#39;ll block URLs to keep this from being a source of spam
392
- ##
393
- exclude &quot;http://&quot;
372
+ exclude “http://”</p>
394
373
 
395
- blacklist &quot;mean_user, private_user&quot;
374
+ <p>blacklist mean_user, private_user”</p>
396
375
 
397
- puts &quot;checking for replies to me&quot;
376
+ <p>puts checking for replies to me
398
377
  replies do |tweet|
399
378
  # replace the incoming username with #USER#, which will be replaced
400
379
  # with the handle of the user who tweeted us by the
401
380
  # replace_variables helper
402
- src = tweet.text.gsub(/@echoes_bot/, &quot;#USER#&quot;)
381
+ src = tweet.text.gsub(/@echoes_bot/, “#USER#”) </p>
403
382
 
404
- # send it back!
383
+ <p># send it back!
405
384
  reply src, tweet
406
385
  end
407
- </code></pre></div>
408
- <h2 id="@spacejamcheck">@SpaceJamCheck</h2>
386
+ ```</p>
387
+
388
+ <h2 id="spacejamcheck">@SpaceJamCheck</h2>
409
389
 
410
390
  <p>This is another working bot. It checks the website for the movie Space
411
391
  Jam to see if it is still online (it does this by using the spacejam
412
392
  gem), and tweets the results of that check.</p>
413
- <div class="highlight"><pre><code class="language-text" data-lang="text">#!/usr/bin/env ruby
414
393
 
415
- require &#39;rubygems&#39;
416
- require &#39;bundler/setup&#39;
394
+ <p>```
395
+ #!/usr/bin/env ruby</p>
417
396
 
418
- require &#39;chatterbot/dsl&#39;
419
- require &#39;spacejam&#39;
397
+ <p>require ‘rubygems’
398
+ require ‘bundler/setup’</p>
420
399
 
421
- #
400
+ <p>require ‘chatterbot/dsl’
401
+ require ‘spacejam’</p>
402
+
403
+ <p>#
422
404
  # this is the script for the twitter bot SpaceJamCheck
423
405
  # generated on 2013-11-04 16:24:46 -0500
424
- #
406
+ #</p>
425
407
 
426
- consumer_key &#39;key&#39;
427
- consumer_secret &#39;secret&#39;
408
+ <p>consumer_key key
409
+ consumer_secret secret’</p>
428
410
 
429
- secret &#39;secret&#39;
430
- token &#39;token&#39;
411
+ <p>secret secret
412
+ token token’</p>
431
413
 
414
+ <p>check_url = “http://www2.warnerbros.com/spacejam/movie/jam.htm”
415
+ check_string = “<title>Space Jam</title>”</p>
432
416
 
433
- check_url = &quot;http://www2.warnerbros.com/spacejam/movie/jam.htm&quot;
434
- check_string = &quot;&lt;title&gt;Space Jam&lt;/title&gt;&quot;
417
+ <p>uptime_messages = [
418
+ “Hooray! Space Jam is still online!”,
419
+ “It’s #{Time.now.year} and the Space Jam website is still online”,
420
+ “In case you were worried, Space Jam is still online”,
421
+ “Looks like the Space Jam website is still there”,
422
+ “Yes”,
423
+ “Yep”,
424
+ “Still Kickin”,
425
+ “The Space Jam website is still online”,
426
+ “Still Online”
427
+ ]</p>
435
428
 
436
- uptime_messages = [
437
- &quot;Hooray! Space Jam is still online!&quot;,
438
- &quot;It&#39;s #{Time.now.year} and the Space Jam website is still online&quot;,
439
- &quot;In case you were worried, Space Jam is still online&quot;,
440
- &quot;Looks like the Space Jam website is still there&quot;,
441
- &quot;Yes&quot;,
442
- &quot;Yep&quot;,
443
- &quot;Still Kickin&quot;,
444
- &quot;The Space Jam website is still online&quot;,
445
- &quot;Still Online&quot;
446
- ]
429
+ <p>downtime_messages = [
430
+ “Hmm, looks like Space Jam isn’t online. Hopefully it’s a fluke ;(“
431
+ ]</p>
447
432
 
448
- downtime_messages = [
449
- &quot;Hmm, looks like Space Jam isn&#39;t online. Hopefully it&#39;s a fluke ;(&quot;
450
- ]
433
+ <p>x = Spacejam::HTTPCheck.new(url:check_url, body:check_string)</p>
451
434
 
452
-
453
- x = Spacejam::HTTPCheck.new(url:check_url, body:check_string)
454
-
455
- # pick a random tweet according to the website status
456
- result = if x.online?
435
+ <h1 id="pick-a-random-tweet-according-to-the-website-status">pick a random tweet according to the website status</h1>
436
+ <p>result = if x.online?
457
437
  uptime_messages
458
438
  else
459
439
  downtime_messages
460
- end.sample
440
+ end.sample</p>
441
+
442
+ <h1 id="add-a-timestamp-this-helps-to-prevent-duplicate-tweet-issues">add a timestamp. this helps to prevent duplicate tweet issues</h1>
443
+ <p>result « ” (#{Time.now.utc})”</p>
461
444
 
462
- # add a timestamp. this helps to prevent duplicate tweet issues
463
- result &lt;&lt; &quot; (#{Time.now.utc})&quot;
445
+ <h1 id="tweet-it-out">tweet it out!</h1>
446
+ <p>tweet result
447
+ ```</p>
464
448
 
465
- # tweet it out!
466
- tweet result
467
- </code></pre></div>
468
449
  <h2 id="streaming-bot">Streaming Bot</h2>
469
- <div class="highlight"><pre><code class="language-text" data-lang="text">#!/usr/bin/env ruby
470
450
 
471
- ## This is a very simple working example of a bot using the streaming
472
- ## API. It&#39;s basically a copy of echoes_bot.rb, just using streaming.
451
+ <p>```
452
+ #!/usr/bin/env ruby</p>
473
453
 
474
- #
454
+ <h2 id="this-is-a-very-simple-working-example-of-a-bot-using-the-streaming">This is a very simple working example of a bot using the streaming</h2>
455
+ <p>## API. It’s basically a copy of echoes_bot.rb, just using streaming.</p>
456
+
457
+ <p>#
475
458
  # require the dsl lib to include all the methods you see below.
476
459
  #
477
- require &#39;rubygems&#39;
478
- require &#39;chatterbot/dsl&#39;
460
+ require rubygems
461
+ require chatterbot/dsl’</p>
479
462
 
480
- consumer_secret &#39;foo&#39;
481
- secret &#39;bar&#39;
482
- token &#39;biz&#39;
483
- consumer_key &#39;bam&#39;
463
+ <p>consumer_secret foo
464
+ secret bar
465
+ token biz
466
+ consumer_key bam’</p>
484
467
 
468
+ <p>puts “Loading echoes_bot.rb using the streaming API”</p>
485
469
 
486
- puts &quot;Loading echoes_bot.rb using the streaming API&quot;
470
+ <p>exclude “http://”, “https://”</p>
487
471
 
488
- exclude &quot;http://&quot;, &quot;https://&quot;
472
+ <p>blacklist “mean_user, private_user”</p>
489
473
 
490
- blacklist &quot;mean_user, private_user&quot;
491
-
492
- streaming do
474
+ <p>streaming do
493
475
  favorited do |user, tweet|
494
- reply &quot;@#{user.screen_name} thanks for the fave!&quot;, tweet
495
- end
476
+ reply “@#{user.screen_name} thanks for the fave!”, tweet
477
+ end</p>
496
478
 
497
- followed do |user|
498
- tweet &quot;@#{user.screen_name} just followed me!&quot;
479
+ <p>followed do |user|
480
+ tweet “@#{user.screen_name} just followed me!”
499
481
  follow user
500
- end
482
+ end</p>
501
483
 
502
- replies do |tweet|
503
- favorite tweet
484
+ <p>replies do |tweet|
485
+ favorite tweet</p>
486
+
487
+ <pre><code>puts "It's a tweet!"
488
+ src = tweet.text.gsub(/@echoes_bot/, "#USER#")
489
+ reply src, tweet end end
490
+ </code></pre>
491
+
492
+ <p>```</p>
504
493
 
505
- puts &quot;It&#39;s a tweet!&quot;
506
- src = tweet.text.gsub(/@echoes_bot/, &quot;#USER#&quot;)
507
- reply src, tweet
508
- end
509
- end
510
- </code></pre></div>
511
494
 
512
495
  </div>
513
496
 
@@ -515,7 +498,9 @@ end
515
498
 
516
499
  <div class=row-fluid>
517
500
  <div id=footer class=span12>
518
- Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
501
+ <!--
502
+ Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
503
+ -->
519
504
 
520
505
  </div>
521
506
  </div>