chatterbot 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -5
  3. data/Gemfile +9 -17
  4. data/Rakefile +2 -18
  5. data/chatterbot.gemspec +10 -11
  6. data/docs/Gemfile +3 -0
  7. data/docs/README.md +3 -0
  8. data/docs/_config.yml +37 -0
  9. data/docs/_includes/footer.html +3 -0
  10. data/docs/_includes/header.html +4 -0
  11. data/docs/_includes/navigation.html +23 -0
  12. data/docs/_layouts/default.html +98 -0
  13. data/docs/_layouts/page.html +11 -0
  14. data/docs/_posts/.gitkeep +0 -0
  15. data/docs/_site/Gemfile +3 -0
  16. data/docs/_site/advanced.html +476 -0
  17. data/docs/_site/configuration.html +456 -0
  18. data/docs/_site/contributing.html +433 -0
  19. data/docs/_site/css/main.css +58 -0
  20. data/docs/_site/css/syntax.css +61 -0
  21. data/docs/_site/deploying.html +468 -0
  22. data/docs/_site/examples.html +574 -0
  23. data/docs/_site/features.html +497 -0
  24. data/docs/_site/images/01-create-application.png +0 -0
  25. data/docs/_site/images/02-application-permissions.png +0 -0
  26. data/docs/_site/images/03-mobile-number.png +0 -0
  27. data/docs/_site/images/04-access-token.png +0 -0
  28. data/docs/_site/index.html +482 -0
  29. data/docs/_site/javascripts/main.js +1 -0
  30. data/docs/_site/other-tools.html +438 -0
  31. data/docs/_site/params.json +1 -0
  32. data/docs/_site/rdoc.html +428 -0
  33. data/docs/_site/setup.html +500 -0
  34. data/docs/_site/streaming.html +506 -0
  35. data/docs/_site/stylesheets/pygment_trac.css +68 -0
  36. data/docs/_site/stylesheets/stylesheet.css +247 -0
  37. data/docs/_site/tut.html +422 -0
  38. data/docs/_site/twitter-docs.html +428 -0
  39. data/docs/_site/walkthrough.html +463 -0
  40. data/docs/advanced.md +67 -0
  41. data/docs/basics.md +12 -0
  42. data/docs/bin/jekyll-page +109 -0
  43. data/docs/configuration.md +32 -0
  44. data/docs/contributing.md +14 -0
  45. data/docs/css/main.css +58 -0
  46. data/docs/css/syntax.css +61 -0
  47. data/docs/deploying.md +53 -0
  48. data/docs/examples.md +168 -0
  49. data/docs/features.md +88 -0
  50. data/docs/images/01-create-application.png +0 -0
  51. data/docs/images/02-application-permissions.png +0 -0
  52. data/docs/images/03-mobile-number.png +0 -0
  53. data/docs/images/04-access-token.png +0 -0
  54. data/docs/index.md +70 -0
  55. data/docs/javascripts/main.js +1 -0
  56. data/docs/other-tools.md +17 -0
  57. data/docs/params.json +1 -0
  58. data/docs/rdoc.md +6 -0
  59. data/docs/setup.md +84 -0
  60. data/docs/streaming.md +98 -0
  61. data/docs/stylesheets/pygment_trac.css +68 -0
  62. data/docs/stylesheets/stylesheet.css +247 -0
  63. data/docs/tips.md +22 -0
  64. data/docs/tut.md +6 -0
  65. data/docs/twitter-docs.md +6 -0
  66. data/docs/walkthrough.md +46 -0
  67. data/examples/streaming_bot.rb +11 -10
  68. data/ext/mkrf_conf.rb +28 -0
  69. data/lib/chatterbot/bot.rb +5 -1
  70. data/lib/chatterbot/config.rb +1 -1
  71. data/lib/chatterbot/home_timeline.rb +1 -1
  72. data/lib/chatterbot/streaming.rb +11 -1
  73. data/lib/chatterbot/version.rb +1 -1
  74. data/spec/spec_helper.rb +1 -4
  75. metadata +71 -122
  76. data/examples/tweet_logger.rb +0 -68
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d88eeab29e199d49fb99f081f90d483263c57d9
4
- data.tar.gz: 92dbfd810dc21b7c638bc6ff22903194881734e3
3
+ metadata.gz: 291622b1f2a0cbb3b3c7eefd3b3cdee644cec193
4
+ data.tar.gz: db6c7840161544af76021b4e6f86f347c1f74919
5
5
  SHA512:
6
- metadata.gz: f33ae22b7f5ebf4d3e774aa95a9761cb4ec8c8970e670ca89181fdf64507814d034fecd206fc52aa0469f3d6c4c854a69395be31a0de4fcde04bfc4f05f181c4
7
- data.tar.gz: 5ab5abed1989ef5963b7d2b7b422b433cb7581aa7cd24ccbaee63fc07b9153aaaf9f3cf9c406ef46568844d4140c048402a0bc4e59dc82ebf0607e09e275b69d
6
+ metadata.gz: d2c631c18d4c99ed808ad43668a9a2f00915404185e275f62a830cd3d685113f8b0289622b2832c03acc3d9ddf489488b5798bff10793a424d38a847ca0af5b5
7
+ data.tar.gz: 249cd8b6ad2be5921b60b32c5d39ac2bd54f19aace9c0c6db9332dbe696b8cf6145796e318bab047c5345e0f9818c3783f67788dd320172ca3a2d5903bf9fe77
@@ -1,11 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1.1
5
- - 2.2.0
6
- - ruby-head
3
+ - 2.2.2
4
+ - 2.3.0
7
5
  before_install:
8
- - gem install bundler -v '~> 1.11'
6
+ - echo "yes" | gem uninstall json; gem install bundler -v '~> 1.11'
9
7
 
10
8
  # uncomment this line if your project needs to run something other than `rake`:
11
9
  # script: bundle exec rspec spec
data/Gemfile CHANGED
@@ -2,29 +2,21 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- #gem "twitter_oauth"
6
- #gem "sequel"
5
+ gem 'rake'
6
+ gem 'yard'
7
7
 
8
8
  # Add dependencies to develop your gem here.
9
9
  # Include everything needed to run rake, tests, features, etc.
10
10
  group :development do
11
- #gem 'simplecov', :require => false, :group => :test
12
-
13
- #gem "shoulda", ">= 0"
14
- #gem "rspec"
15
- #gem "rake"
16
- #gem "twitter", "~> 4.4.0"
17
-
18
- #gem "watchr"
11
+ gem 'pry'
19
12
  end
20
13
 
21
- gem "pry"
22
14
 
23
- #
24
- # couple extra gems for testing db connectivity
25
- #
26
15
  group :test do
27
- gem "sequel"
28
- gem "mysql"
29
- gem "sqlite3"
16
+ gem 'rspec', '~> 3.5.0'
17
+ gem 'rspec-mocks', '~> 3.5.0'
18
+ gem 'simplecov', '>= 0'
19
+ gem 'observr', '>= 0'
30
20
  end
21
+
22
+
data/Rakefile CHANGED
@@ -1,30 +1,12 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
- require "chatterbot/version"
5
-
6
4
  require 'rspec/core'
7
5
  require 'rspec/core/rake_task'
8
6
  RSpec::Core::RakeTask.new(:spec) do |spec|
9
7
  spec.pattern = FileList['spec/**/*_spec.rb']
10
8
  end
11
9
 
12
- RSpec::Core::RakeTask.new(:rcov) do |spec|
13
- spec.pattern = 'spec/**/*_spec.rb'
14
- spec.rcov_opts = %w{--exclude .bundler,.rvm}
15
- spec.rcov = true
16
- end
17
-
18
- task :default => :spec
19
-
20
- require 'rdoc/task'
21
- Rake::RDocTask.new do |rdoc|
22
- rdoc.main = "README.rdoc"
23
- rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
24
- rdoc.rdoc_dir = 'rdoc'
25
- rdoc.title = "'chatterbot #{Chatterbot::VERSION}'"
26
- end
27
-
28
10
  task :console do
29
11
  require 'irb'
30
12
  require 'irb/completion'
@@ -32,3 +14,5 @@ task :console do
32
14
  ARGV.clear
33
15
  IRB.start
34
16
  end
17
+
18
+ task :default => :spec
@@ -1,5 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ #$:.push File.expand_path("../lib", __FILE__)
3
6
  require "chatterbot/version"
4
7
 
5
8
  Gem::Specification.new do |s|
@@ -20,18 +23,14 @@ Gem::Specification.new do |s|
20
23
  s.require_paths = ["lib"]
21
24
  s.licenses = ["MIT"]
22
25
 
23
- s.add_development_dependency(%q<redcarpet>, [">= 0"])
26
+ # load activesupport but check ruby version along the way
27
+ s.extensions << 'ext/mkrf_conf.rb'
28
+
24
29
  s.add_runtime_dependency(%q<oauth>, ["~> 0.4.7"])
25
- s.add_runtime_dependency(%q<twitter>, ["~> 5.16.0"])
30
+ s.add_runtime_dependency(%q<twitter>, ["~> 6.1.0"])
26
31
  s.add_runtime_dependency(%q<launchy>, [">= 2.4.2"])
27
32
  s.add_runtime_dependency(%q<colorize>, [">= 0.7.3"])
28
- s.add_development_dependency(%q<yard>, [">= 0"])
29
- s.add_development_dependency(%q<shoulda>, [">= 0"])
30
- s.add_development_dependency(%q<rake>, ["< 11"])
31
- s.add_development_dependency(%q<rspec>, ["~> 3.0.0"])
32
- s.add_development_dependency(%q<rspec-mocks>, ["~> 3.0.2"])
33
- s.add_development_dependency(%q<rdoc>, [">= 0"])
34
- s.add_development_dependency(%q<simplecov>, [">= 0"])
35
- s.add_development_dependency(%q<observr>, [">= 0"])
33
+
34
+ s.add_development_dependency 'bundler', '~> 1.0'
36
35
  end
37
36
 
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gem 'github-pages'
3
+
@@ -0,0 +1,3 @@
1
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/bruth/jekyll-docs-template/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
2
+
3
+ Read the docs: http://bruth.github.io/jekyll-docs-template
@@ -0,0 +1,37 @@
1
+ # Site title and subtitle. This is used in _includes/header.html
2
+ title: 'chatterbot'
3
+ subtitle: 'twitter bots in ruby'
4
+
5
+ # Enable/show navigation. There are there options:
6
+ # 0 - always hide
7
+ # 1 - always show
8
+ # 2 - show only if posts are present
9
+ navigation: 1
10
+
11
+ # URL to source code, used in _includes/footer.html
12
+ codeurl: 'https://github.com/muffinista/chatterbot'
13
+
14
+ # Default categories (in order) to appear in the navigation
15
+ sections: [
16
+ ['tut', 'Getting Started'],
17
+ ['doc', 'Documentation'],
18
+ ['dev', 'Developers'],
19
+ ['links', 'Resources']
20
+ ]
21
+
22
+ # Keep as an empty string if served up at the root. If served up at a specific
23
+ # path (e.g. on GitHub pages) leave off the trailing slash, e.g. /my-project
24
+ baseurl: '/chatterbot'
25
+
26
+ # Dates are not included in permalinks
27
+ permalink: none
28
+
29
+ # Syntax highlighting
30
+ highlighter: 'rouge'
31
+
32
+ # Since these are pages, it doesn't really matter
33
+ future: true
34
+
35
+ # Exclude non-site files
36
+ exclude: ['bin', 'README.md']
37
+
@@ -0,0 +1,3 @@
1
+ <!--
2
+ Documentation for <a href="{% if site.codeurl %}{{ site.codeurl }}{% else %}{{ site.baseurl }}{% endif %}">{{ site.title }}</a>
3
+ -->
@@ -0,0 +1,4 @@
1
+ <h4><a class=brand href="{{ site.baseurl }}/">{{ site.title }}</a>
2
+ {% if site.subtitle %}<small>{{ site.subtitle }}</small>{% endif %}
3
+ </h4>
4
+
@@ -0,0 +1,23 @@
1
+ <ul class="nav nav-list">
2
+ <li><a href="{{ site.baseurl }}/">Home</a></li>
3
+ {% for section in site.sections %}
4
+ {% assign attr = section[0] %}
5
+ {% assign label = section[1] %}
6
+ <li class=nav-header>{{ label }}</li>
7
+ {% for page in site.pages %}
8
+ {% if page.published != false %}
9
+ {% if page.category == attr %}
10
+ <li data-order="{{ page.order }}">
11
+ {% if page.link %}
12
+ <a href="{{ page.link }}">{{ page.title }}</a>
13
+ {% else %}
14
+ <a href="{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a>
15
+ {% endif %}
16
+ </li>
17
+ {% endif %}
18
+ {% endif %}
19
+ {% endfor %}
20
+ {% endfor %}
21
+ <!-- List additional links. It is recommended to add a divider
22
+ e.g. <li class=divider></li> first to break up the content. -->
23
+ </ul>
@@ -0,0 +1,98 @@
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>{{ site.title }}{% if page.title %} : {{ page.title }}{% endif %}</title>
9
+ <meta name="description" content="{{ site.subtitle }}">
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="{{ site.baseurl }}/css/syntax.css">
13
+ <link rel="stylesheet" href="{{ site.baseurl }}/css/main.css">
14
+ </head>
15
+ <body>
16
+
17
+ <div class="container">
18
+ <div class=row-fluid>
19
+ <div id=header class=span12>
20
+ {% include header.html %}
21
+ </div>
22
+ </div>
23
+
24
+ <div class=row-fluid>
25
+ {% assign post_count = site.posts|size %}
26
+ {% if site.navigation != 0 and site.navigation == 1 or post_count > 0 %}
27
+ <div id=navigation class=span2>
28
+ {% include navigation.html %}
29
+ </div>
30
+
31
+ <div id=content class=span10>
32
+ {{ content }}
33
+ </div>
34
+ {% else %}
35
+ <div id=content class=span12>
36
+ {{ content }}
37
+ </div>
38
+ {% endif %}
39
+ </div>
40
+
41
+ <div class=row-fluid>
42
+ <div id=footer class=span12>
43
+ {% include footer.html %}
44
+ </div>
45
+ </div>
46
+ </div>
47
+
48
+ <script>
49
+ function orderNav() {
50
+ var list,
51
+ section,
52
+ header,
53
+ sections = [],
54
+ lists = {},
55
+ headers = {};
56
+
57
+ var navUl = document.querySelectorAll('#navigation ul')[0],
58
+ navLis = document.querySelectorAll('#navigation ul li');
59
+
60
+ if (!navUl) return;
61
+
62
+ for (var i = 0; i < navLis.length; i++) {
63
+ var order, li = navLis[i];
64
+
65
+ if (li.classList.contains('nav-header')) {
66
+ section = li.textContent || li.innerText;
67
+ sections.push(section);
68
+ headers[section] = li;
69
+ continue;
70
+ }
71
+
72
+ if (!lists[section]) {
73
+ lists[section] = [];
74
+ }
75
+
76
+ order = parseFloat(li.getAttribute('data-order'))
77
+ lists[section].push([order, li]);
78
+ }
79
+
80
+ for (var i = 0; i < sections.length; i++) {
81
+ section = sections[i];
82
+ list = lists[section].sort(function(a, b) {
83
+ return a[0] - b[0];
84
+ });
85
+
86
+ if (header = headers[section]) {
87
+ navUl.appendChild(header);
88
+ }
89
+ for (var j = 0; j < list.length; j++) {
90
+ navUl.appendChild(list[j][1]);
91
+ }
92
+ }
93
+ }
94
+
95
+ if (document.querySelectorAll) orderNav();
96
+ </script>
97
+ </body>
98
+ </html>
@@ -0,0 +1,11 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ <div class=page-header>
6
+ <h2>{{ page.title }}
7
+ {% if page.subtitle %}<small>{{ page.subtitle }}</small>{% endif %}
8
+ </h2>
9
+ </div>
10
+
11
+ {{ content }}
File without changes
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+ gem 'github-pages'
3
+
@@ -0,0 +1,476 @@
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 : Advanced Features</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>Advanced Features
360
+
361
+ </h2>
362
+ </div>
363
+
364
+ <h2 id="direct-client-access">Direct Client Access</h2>
365
+
366
+ <p>If you want to do something not provided directly by Chatterbot, you
367
+ have access to an instance of Twitter::Client provided by the
368
+ <strong>client</strong> method. In theory, you can do something like this in your
369
+ bot to unfollow users who DM you:</p>
370
+ <div class="highlight"><pre><code class="language-text" data-lang="text">client.direct_messages_received(:since_id =&gt; since_id).each do |m|
371
+ client.unfollow(m.user.name)
372
+ end
373
+ </code></pre></div>
374
+ <h2 id="storing-config-in-the-database">Storing Config in the Database</h2>
375
+
376
+ <p>Sometimes it is preferable to store the authorization credentials for
377
+ your bot in a database. </p>
378
+
379
+ <p>Chatterbot can manage configurations that are stored in the database,
380
+ but to do this you will need to specify how to connect to the
381
+ database. You can do this by specifying the connection string
382
+ either in one of the global config files by setting </p>
383
+ <div class="highlight"><pre><code class="language-text" data-lang="text">:db_uri:mysql://username:password@host/database
384
+ </code></pre></div>
385
+ <p>Or you can specify the connection on the command-line by using the
386
+ --db=&quot;db_uri&quot; configuration option. Any calls to the database are
387
+ handled by the Sequel gem, and MySQL and Sqlite should work. The DB
388
+ URI should be in the form of</p>
389
+ <div class="highlight"><pre><code class="language-text" data-lang="text">mysql://username:password@host/database
390
+ </code></pre></div>
391
+ <p>see <a href="http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html">http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html</a>
392
+ for details.</p>
393
+
394
+ <h2 id="logging-tweets-to-the-database">Logging Tweets to the Database</h2>
395
+
396
+ <p>Chatterbot can log tweet activity to a database if desired. This can
397
+ be handy for archival purposes, or for tracking what&#39;s going on with
398
+ your bot. </p>
399
+
400
+ <p>If you&#39;ve configured your bot for database access, you can store a
401
+ tweet to the database by calling the <code>log</code> method like this:</p>
402
+ <div class="highlight"><pre><code class="language-text" data-lang="text">search &quot;chatterbot&quot; do |tweet|
403
+ log tweet
404
+ end
405
+ </code></pre></div>
406
+ <p>See <code>Chatterbot::Logging</code> for details on this.</p>
407
+
408
+ <h2 id="streaming">Streaming</h2>
409
+
410
+ <p>Chatterbot has basic support for Twitter&#39;s Streaming API. You can read
411
+ more about it <a href="/streaming.html">here</a></p>
412
+
413
+
414
+ </div>
415
+
416
+ </div>
417
+
418
+ <div class=row-fluid>
419
+ <div id=footer class=span12>
420
+ Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
421
+
422
+ </div>
423
+ </div>
424
+ </div>
425
+
426
+ <script>
427
+ function orderNav() {
428
+ var list,
429
+ section,
430
+ header,
431
+ sections = [],
432
+ lists = {},
433
+ headers = {};
434
+
435
+ var navUl = document.querySelectorAll('#navigation ul')[0],
436
+ navLis = document.querySelectorAll('#navigation ul li');
437
+
438
+ if (!navUl) return;
439
+
440
+ for (var i = 0; i < navLis.length; i++) {
441
+ var order, li = navLis[i];
442
+
443
+ if (li.classList.contains('nav-header')) {
444
+ section = li.textContent || li.innerText;
445
+ sections.push(section);
446
+ headers[section] = li;
447
+ continue;
448
+ }
449
+
450
+ if (!lists[section]) {
451
+ lists[section] = [];
452
+ }
453
+
454
+ order = parseFloat(li.getAttribute('data-order'))
455
+ lists[section].push([order, li]);
456
+ }
457
+
458
+ for (var i = 0; i < sections.length; i++) {
459
+ section = sections[i];
460
+ list = lists[section].sort(function(a, b) {
461
+ return a[0] - b[0];
462
+ });
463
+
464
+ if (header = headers[section]) {
465
+ navUl.appendChild(header);
466
+ }
467
+ for (var j = 0; j < list.length; j++) {
468
+ navUl.appendChild(list[j][1]);
469
+ }
470
+ }
471
+ }
472
+
473
+ if (document.querySelectorAll) orderNav();
474
+ </script>
475
+ </body>
476
+ </html>