wit_bot 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/wit_bot/bot/USAGE +8 -0
- data/lib/generators/wit_bot/bot/bot_generator.rb +12 -0
- data/lib/generators/wit_bot/bot/templates/bot.rb.erb +19 -0
- data/lib/generators/wit_bot/setup/USAGE +8 -0
- data/lib/generators/wit_bot/setup/setup_generator.rb +11 -0
- data/lib/generators/wit_bot/setup/templates/initializer.rb +4 -0
- data/lib/wit_bot/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6665e746f0e43cac8afda18e6597652e9938c3c8
|
4
|
+
data.tar.gz: 61201b2b210381924ebbafebf873117d32f7fbec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6b754b9c04dafd6a263b400f0d6423b0ccb553a0f809aa905c56145c2f463e3529d304949275e94c8058b1793d543b568db1ac6b888e05ee6291d80ec034565
|
7
|
+
data.tar.gz: 984e8ba0c67d29c9365bb9c794a6085f2cd142058ce1190bfd619b9544475f5a42899bf10b11d155e2f3b871df5ceaedbe261290e7301cbe9c85a0f638c84c0f
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module WitBot
|
2
|
+
module Generators
|
3
|
+
class BotGenerator < Rails::Generators::NamedBase
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
argument :intents, type: :array, default: nil
|
6
|
+
|
7
|
+
def create_bot
|
8
|
+
template 'bot.rb.erb', "app/wit_bot/#{file_name}_bot.rb"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class <%=class_name%>Bot < WitBot::Bot::Base
|
2
|
+
# Set the intents your app listens to:
|
3
|
+
<% if intents && !intents.empty? %>
|
4
|
+
intents <%= intents.map{|i| ":#{i.to_s}"}.join(', ') %>
|
5
|
+
|
6
|
+
<% intents.each do |intent| %>
|
7
|
+
# When the <%= intent %> intent is received...
|
8
|
+
def on_<%= intent %>(message)
|
9
|
+
# Do something
|
10
|
+
end
|
11
|
+
<% end %>
|
12
|
+
<% else %>
|
13
|
+
# intents :example_intent, :example2 ...
|
14
|
+
|
15
|
+
# def on_example_intent(message)
|
16
|
+
# # do something
|
17
|
+
# end
|
18
|
+
<% end %>
|
19
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module WitBot
|
2
|
+
module Generators
|
3
|
+
class SetupGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def create_initializer_file
|
7
|
+
copy_file 'initializer.rb', 'config/initializers/wit_bot.rb'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/wit_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wit_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben (@penne12_)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,6 +148,12 @@ files:
|
|
148
148
|
- examples/helpers/helpers.rb
|
149
149
|
- examples/simple.rb
|
150
150
|
- examples/thread.rb
|
151
|
+
- lib/generators/wit_bot/bot/USAGE
|
152
|
+
- lib/generators/wit_bot/bot/bot_generator.rb
|
153
|
+
- lib/generators/wit_bot/bot/templates/bot.rb.erb
|
154
|
+
- lib/generators/wit_bot/setup/USAGE
|
155
|
+
- lib/generators/wit_bot/setup/setup_generator.rb
|
156
|
+
- lib/generators/wit_bot/setup/templates/initializer.rb
|
151
157
|
- lib/wit_bot.rb
|
152
158
|
- lib/wit_bot/bot/base.rb
|
153
159
|
- lib/wit_bot/bot/conversation/base.rb
|