bot_framework 0.1.0beta → 0.1.0beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -1
  3. data/README.md +14 -1
  4. data/appveyor.yml +20 -0
  5. data/bot_framework.gemspec +6 -0
  6. data/examples/dialog/basic_first_run.rb +12 -0
  7. data/examples/ruby_conf/Gemfile +8 -0
  8. data/examples/ruby_conf/Gemfile.lock +85 -0
  9. data/examples/ruby_conf/bot.rb +88 -0
  10. data/examples/ruby_conf/config.ru +6 -0
  11. data/examples/ruby_conf/speaker_data.yaml +41 -0
  12. data/examples/simple_regex/Gemfile +6 -0
  13. data/examples/simple_regex/Gemfile.lock +63 -0
  14. data/examples/simple_regex/bot.rb +35 -0
  15. data/examples/simple_regex/config.ru +6 -0
  16. data/images/emulator1.png +0 -0
  17. data/images/emulator2.png +0 -0
  18. data/lib/bot_framework.rb +12 -0
  19. data/lib/bot_framework/api_base.rb +6 -4
  20. data/lib/bot_framework/bot.rb +47 -2
  21. data/lib/bot_framework/connector.rb +13 -5
  22. data/lib/bot_framework/console_connector.rb +17 -0
  23. data/lib/bot_framework/dialogs/action_set.rb +66 -0
  24. data/lib/bot_framework/dialogs/dialog.rb +25 -0
  25. data/lib/bot_framework/dialogs/entity_recognizer.rb +123 -0
  26. data/lib/bot_framework/dialogs/luis_recognizer.rb +72 -0
  27. data/lib/bot_framework/dialogs/reg_exp_recognizer.rb +41 -0
  28. data/lib/bot_framework/dialogs/simple_dialog.rb +29 -0
  29. data/lib/bot_framework/events/event_emitter.rb +6 -0
  30. data/lib/bot_framework/message.rb +80 -0
  31. data/lib/bot_framework/models/object.rb +0 -1
  32. data/lib/bot_framework/prompt.rb +62 -0
  33. data/lib/bot_framework/server.rb +1 -1
  34. data/lib/bot_framework/session.rb +407 -0
  35. data/lib/bot_framework/simple_prompt_recognizer.rb +4 -0
  36. data/lib/bot_framework/token_validator.rb +6 -4
  37. data/lib/bot_framework/universal_bot.rb +7 -0
  38. data/lib/bot_framework/version.rb +1 -1
  39. metadata +100 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: affe51df6b475a675f090f4130ced19a0f2ff6c9
4
- data.tar.gz: 053aa8a5ace3a3fbd89fbe8ddb61d9ea168786f0
3
+ metadata.gz: 1c07215bb82060edbbd21768944bfb0ec1ff09e7
4
+ data.tar.gz: c6a1f2a54951dbda6a127986d4dd258aba8054c4
5
5
  SHA512:
6
- metadata.gz: d07903a48bc1036bb7f1e3c8960d7fd9d24ef5face9fccc1975e66e6ec1090f078e7425e718d5f6f8c91eb1d3db5b031035a6deb506a3af2feb57b0e6aa7dce3
7
- data.tar.gz: b639f369042b2b8ccc98ea589cb1a29018e767f1ce2572755c4c2ab7eda79c0dc78f96f39ec1dfc82abcdcd1a4857260fc12581a9be6fff1c62c26b7f009ee5d
6
+ metadata.gz: 809d65ce001086add7ebc2d998d2610b59989cd6799b5ed9813c6149b5dc2db8ddc75b0c7a35bb326d5bcc6a7f3c0a38d0f09a244e658eecd38f2bef22dc2c8f
7
+ data.tar.gz: a3939ddc90d7d1473ccbdb43ef4d00f867e6e56fb3623bf7a59456065a03e0d21a7c657dd769b14c9ff207a5530bf0bb389684cfc4ce8ad3eb1a68cdba97bf12
@@ -2,4 +2,7 @@ sudo: false
2
2
  language: ruby
3
3
  rvm:
4
4
  - 2.3.1
5
- before_install: gem install bundler -v 1.12.5
5
+ - 2.4.0
6
+ - 2.4.1
7
+ before_install: gem install bundler
8
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # BotFramework
2
2
 
3
+ [![Build Status](https://travis-ci.org/tachyons/botframework-ruby.svg?branch=master)](https://travis-ci.org/tachyons/botframework-ruby)
4
+ [![Build status](https://ci.appveyor.com/api/projects/status/fdbwdbvv3viswwec?svg=true)](https://ci.appveyor.com/project/tachyons/botframework-ruby)
5
+
3
6
  Ruby client to make statefull bots using microsoft botframework . Currently under development , don't try this in under production till v1.0
4
7
 
5
8
  ## Installation
@@ -43,6 +46,16 @@ end
43
46
 
44
47
  ```
45
48
 
49
+ ## Emulator
50
+
51
+ You can use botframework emulator for testing your bot in local system.
52
+ * Download https://github.com/Microsoft/BotFramework-Emulator
53
+ * run `rackup` in the bot directory
54
+ * Give url(default url for rackup is `localhost:9292`) and botframework credentials in the emulator
55
+
56
+ ![emulator1](images/emulator1.png)
57
+ ![emulator2](images/emulator2.png)
58
+
46
59
  ## Development
47
60
 
48
61
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -51,7 +64,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
51
64
 
52
65
  ## Contributing
53
66
 
54
- Bug reports and pull requests are welcome on GitHub at https://github.com/tachyons/bot_framework. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
67
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tachyons/botframework-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
55
68
 
56
69
 
57
70
  ## License
@@ -0,0 +1,20 @@
1
+ version: '{build}'
2
+
3
+ skip_tags: true
4
+
5
+ environment:
6
+ matrix:
7
+ - ruby_version: "22"
8
+ - ruby_version: "22-x64"
9
+ - ruby_version: "23"
10
+ - ruby_version: "23-x64"
11
+
12
+ install:
13
+ - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
14
+ - gem install bundler --no-document -v 1.14.6
15
+ - bundle install --retry=3
16
+
17
+ test_script:
18
+ - bundle exec rake
19
+
20
+ build: off
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.bindir = 'exe'
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ['lib']
21
+ spec.required_ruby_version = '>= 2.2.0'
21
22
 
22
23
  spec.add_development_dependency 'bundler', '~> 1.12'
23
24
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -28,4 +29,9 @@ Gem::Specification.new do |spec|
28
29
  spec.add_dependency 'jwt'
29
30
  spec.add_dependency 'httparty'
30
31
  spec.add_dependency 'rack'
32
+ spec.add_dependency 'timers'
33
+ spec.add_dependency 'rb-readline'
34
+ spec.add_dependency 'chronic'
35
+ spec.add_dependency 'chronic_duration'
36
+ spec.add_dependency 'nio4r'
31
37
  end
@@ -0,0 +1,12 @@
1
+ require 'pry'
2
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'bot_framework'
4
+ require 'bot_framework/console_connector'
5
+ require 'bot_framework/universal_bot'
6
+ # Setup bot and root message handler
7
+ include BotFramework
8
+
9
+ connector = ConsoleConnector.new.listen
10
+ bot = UniversalBot.new(connector, lambda do |session|
11
+ session.send("You said #{session.message.text}")
12
+ end)
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+ ruby '2.4.0'
3
+
4
+ gem 'puma'
5
+ gem 'pry'
6
+ gem 'luis', github: 'tachyons/luis', branch: 'master'
7
+ gem 'bot_framework', github: 'tachyons/botframework-ruby', branch: 'master'
8
+ gem 'bmtc', github: 'tachyons/bmtc', branch: 'master'
@@ -0,0 +1,85 @@
1
+ GIT
2
+ remote: git://github.com/tachyons/bmtc.git
3
+ revision: 9d258bf430469611f7c14a0f66badf65286dc6b4
4
+ branch: master
5
+ specs:
6
+ bmtc (0.1.2)
7
+ httparty
8
+ json
9
+
10
+ GIT
11
+ remote: git://github.com/tachyons/botframework-ruby.git
12
+ revision: 6970d4c6d2fe9c13e2425194dbc2b47627e35f5e
13
+ branch: master
14
+ specs:
15
+ bot_framework (0.1.0beta)
16
+ chronic
17
+ chronic_duration
18
+ httparty
19
+ jwt
20
+ nio4r
21
+ oauth2
22
+ rack
23
+ rb-readline
24
+ timers
25
+
26
+ GIT
27
+ remote: git://github.com/tachyons/luis.git
28
+ revision: 3bbb3c08b6e915ef0674ae6e4c4dda6df4920c46
29
+ branch: master
30
+ specs:
31
+ luis (0.1.1beta)
32
+ httparty
33
+
34
+ GEM
35
+ remote: https://rubygems.org/
36
+ specs:
37
+ chronic (0.10.2)
38
+ chronic_duration (0.10.6)
39
+ numerizer (~> 0.1.1)
40
+ coderay (1.1.1)
41
+ faraday (0.11.0)
42
+ multipart-post (>= 1.2, < 3)
43
+ hitimes (1.2.4)
44
+ httparty (0.14.0)
45
+ multi_xml (>= 0.5.2)
46
+ json (2.1.0)
47
+ jwt (1.5.6)
48
+ method_source (0.8.2)
49
+ multi_json (1.12.1)
50
+ multi_xml (0.6.0)
51
+ multipart-post (2.0.0)
52
+ nio4r (2.0.0)
53
+ numerizer (0.1.1)
54
+ oauth2 (1.3.1)
55
+ faraday (>= 0.8, < 0.12)
56
+ jwt (~> 1.0)
57
+ multi_json (~> 1.3)
58
+ multi_xml (~> 0.5)
59
+ rack (>= 1.2, < 3)
60
+ pry (0.10.4)
61
+ coderay (~> 1.1.0)
62
+ method_source (~> 0.8.1)
63
+ slop (~> 3.4)
64
+ puma (3.8.2)
65
+ rack (2.0.1)
66
+ rb-readline (0.5.4)
67
+ slop (3.6.0)
68
+ timers (4.1.2)
69
+ hitimes
70
+
71
+ PLATFORMS
72
+ ruby
73
+
74
+ DEPENDENCIES
75
+ bmtc!
76
+ bot_framework!
77
+ luis!
78
+ pry
79
+ puma
80
+
81
+ RUBY VERSION
82
+ ruby 2.4.0p0
83
+
84
+ BUNDLED WITH
85
+ 1.14.6
@@ -0,0 +1,88 @@
1
+
2
+ BotFramework.configure do |connector|
3
+ connector.app_id = ENV['RUBY_CONF_MICROSOFT_APP_ID']
4
+ connector.app_secret = ENV['RUBY_CONF_MICROSOFT_APP_PASSWORD']
5
+ end
6
+
7
+ SPEAKER_DATA = YAML.load_file('speaker_data.yaml')
8
+ RUBY_CONF_DATA = {
9
+ 'when'=> 'Jan 27, 28, 29',
10
+ 'where' => 'Kochi',
11
+ 'venue' => 'Le Méridien Kochi',
12
+ 'organisers' => 'Emerging technology trust',
13
+ 'website' => 'http://rubyconfindia.org/'
14
+ }
15
+
16
+ BotFramework::Bot.recognizer = BotFramework::Dialogs::LuisRecognizer.new('https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/f5104c51-8adc-4846-ba86-058ee25d88b2?subscription-key=d670862831e046c9bf1d8e9b0c485df2&q=')
17
+
18
+ BotFramework::Bot.on :activity do |activity|
19
+ # All activities
20
+ end
21
+
22
+ BotFramework::Bot.on :message do |activity|
23
+ # Call back for messages
24
+ end
25
+
26
+ BotFramework::Bot.on :ping do |activity|
27
+ # Callback for pings
28
+ end
29
+
30
+ BotFramework::Bot.on :typing do |activity|
31
+ # Callback for typing
32
+ end
33
+ def speaker_data(activity, entities, field)
34
+ speaker = BotFramework::Dialogs::EntityRecognizer.find_entity(entities, 'speaker')
35
+ speaker ||= conversation_data(activity)['speaker']
36
+ if speaker && (SPEAKER_DATA[speaker[:entity]] || SPEAKER_DATA[speaker['entity']])
37
+ set_conversation_data(activity, speaker: speaker)
38
+ (SPEAKER_DATA[speaker[:entity]] || SPEAKER_DATA[speaker['entity']])[field]
39
+ elsif speaker
40
+ "Unable to find the speaker #{speaker[:entity]}"
41
+ else
42
+ 'Could not find the speaker'
43
+ end
44
+ end
45
+
46
+ BotFramework::Bot.on_intent 'speakerList' do |activity, _intents|
47
+ reply(activity, SPEAKER_DATA.keys.map(&:capitalize).join(','))
48
+ end
49
+
50
+ BotFramework::Bot.on_intent 'speakerTopic' do |activity, intents|
51
+ entities = intents[:entities]
52
+ reply(activity, speaker_data(activity, entities, 'topic'))
53
+ end
54
+
55
+ BotFramework::Bot.on_intent 'speakerDescription' do |activity, intents|
56
+ entities = intents[:entities]
57
+ reply(activity, speaker_data(activity, entities, 'description'))
58
+ end
59
+
60
+ BotFramework::Bot.on_intent 'speakerTwitterHandle' do |activity, intents|
61
+ entities = intents[:entities]
62
+ reply(activity, speaker_data(activity, entities, 'twitter'))
63
+ end
64
+
65
+ BotFramework::Bot.on_intent 'speakerTalkTime' do |activity, intents|
66
+ entities = intents[:entities]
67
+
68
+ reply(activity, speaker_data(activity, entities, 'talk_date'))
69
+ end
70
+
71
+ BotFramework::Bot.on_intent 'eventSchedule' do |activity, intents|
72
+ # entities = intents[:entities]
73
+ # reply(activity, speaker_data(activity, entities,'talk_date'))
74
+ end
75
+
76
+ BotFramework::Bot.on_intent 'rubyconfDetails' do |activity, intents|
77
+ entities = intents[:entities]
78
+ detail = BotFramework::Dialogs::EntityRecognizer.find_entity(entities, 'eventDetailType')
79
+ if detail && RUBY_CONF_DATA[detail[:entity]]
80
+ reply(activity, RUBY_CONF_DATA[detail[:entity]])
81
+ else
82
+ reply(activity, "Sorry, I coudn't find that data")
83
+ end
84
+ end
85
+
86
+ BotFramework::Bot.on_intent :default do |activity, _intents|
87
+ reply(activity, 'Help text')
88
+ end
@@ -0,0 +1,6 @@
1
+ require 'pry'
2
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'bot_framework'
4
+ require_relative 'bot'
5
+ # include BotFramework
6
+ run BotFramework::Server
@@ -0,0 +1,41 @@
1
+ 'aaron cruz':
2
+ twitter: mraaroncruz
3
+ talk_date: '29 Jan 2017'
4
+ description: 'Aaron lives in the suburbs of Vienna, Austria but is a native of the suburbs of Seattle. In his former life he was a shepherd, a cheesemaker and a sous chef. Now he is freelancing, building native iOS and Android apps and their respective API''s. In his spare time, he organizes a range of user groups in Vienna. If you get him started talking about food, he may never stop.'
5
+ topic: 'This Bot Will Pump You Up!'
6
+ 'adam hawkins':
7
+ twitter: adman65
8
+ talk_date: '29 Jan 2017'
9
+ description: 'Adam is a proud traveller and trance addict. He lives in Bangalore, India. Right now his full time gig is for Saltside. He runs the SRE team and trains a new generation of engineers how to build, ship and operate production systems according to the DevOps philosophy using Docker.'
10
+ topic: 'Production Ready Ruby'
11
+ 'anagha r':
12
+ topic: 'Getting Started With Rails'
13
+ description: 'Anagha is an undergraduate student doing her computer science and engineering from Amrita University and an open source enthusiast. She has developed a basic application in Ruby on Rails and is currently developing it based upon her existing knowledge. She is a GHCI2016 student scholar and an advisor for the #include fellowship program by the she++ communit'
14
+ 'anil wadghule':
15
+ topic: 'Talk: concurrent-ruby modern tools explained'
16
+ description: 'Anil is currently an Independent Software Consultant and helps organising Deccan RubyConf. When not programming, he spends time in exploring music around the world. Emacs is his text editor of choice. He loves learning different programming languages so that he can use right one at right place. He believes in improvising solutions till they are perfectly right.'
17
+ 'kiran narasareddy':
18
+ topic: '10 things (not) to do before going to production with rails+mongo+sidekiq'
19
+ description: 'Kiran, one of the Co-Founders, heads the Technology division at Amura. With a passion for all things tech, he is always on the lookout for the latest trends and has been successful in leveraging them to maintain Amura''s competitive advantage in the digital space. Kiran''s expertise in technology took root right from his college days, where he built a complex decision-making engine for the US mortgage industry. Consequently, his proficiency in defining high level design and architecture, his data modelling skills as well as his acute interest in executing large scale systems have helped Amura launch Sell.Do, an industry leader in Real Estate Sales and Marketing Automation. With a penchant for coming up with quirky names for products, Kiran can usually be found wired into his mac, hacking on for the next big thing for Amura'
20
+ 'prasun anand':
21
+ topic: 'Scientific Computing on JRuby'
22
+ description: 'Prasun is a final-year student at BITS Pilani, Goa, India pursuing a dual degree in M.Sc. in Biological Sciences and B.E. in Chemical Engineering. He is a SciRuby contributor, Bioinformatics enthusiast and has worked on ''JRuby port of NMatrix'' in context of GSoC 2016. In his earlier days, he contributed to Javascript projects. Currently, he is working on bringing High-Performance GPU computation to Ruby (MRI and JRuby) using OpenCL by building ArrayFire gem. In his spare time, he likes playing Mortal Komba'
23
+ 'richard dchneeman':
24
+ topic: SLOMO
25
+ description: 'Richard ''Ruby Hero'' Schneems writes Ruby at Heroku, maintains CodeTriage.com, and co-organizes Keep Ruby Weird. He is in the top 50 Rails contributors and is an accidental maintainer of Sprockets. When he isn''t obsessively compulsively woodworking he writes such gems as Wicked, and derailed_benchmarks. Schneems wants you to have a nice day.'
26
+ 'sameer deshmukh':
27
+ topic: 'Introducing Rubex: A better way to write Ruby extensions'
28
+ description: 'Sameer is a Computer Engineering graduate from Pune University. He maintains scientific Ruby libraries as a maintainer for the Ruby Science Foundation (SciRuby). He is the author of daru, a DataFrame library for Ruby and is currently working full time on building Rubex, a new language to make it easier to write extensions for Ruby. He loves solo travelling and is also a part time musician - playing the bass guitar for his band Cat Kamikazee.'
29
+ 'shashank date':
30
+ topic: '(m)Ruby on small devices'
31
+ description: 'Shashank Daté has been programming in Ruby professionally since 2002. He has contributed to the very early versions of Ruby One Click installer on Windows and win32utils - a set of Ruby libraries for Windows. He is the technical editor of The Ruby Way (2nd. ed) by Hal Fulton. He has been instrumental in making Ruby popular in his hometowns (KC, USA and Pune, India). He co-founded Kansas City Ruby User Group. In 2011/12, he was on the organizing committee of Ruby Midwest regional conferences.'
32
+ 'shaunak pagnis':
33
+ topic: '(m)Ruby on small devices'
34
+ description: 'Shaunak is a core team member of Amura''s product division, Sell.Do, where he contributes to large scale Rails based products. Introduced to Ruby 4 years ago, it has since been his go-to language. When not working, you''ll probably find him listening to Metallica or exploring complex magic systems of Brandon Sanderson''s Cosmere.'
35
+ 'swanand pagnis':
36
+ topic: 'It''s 2017, and I _still_ want to sell you a graph database!'
37
+ description: 'Swanand is a Principal Engineer at First.io and an organiser at Garden City RubyConf. Fancy titles apart, he''s a software engineer who spent the last decade writing some bad code, and some good code, and shipping software to users. He loves writing software, building communities, and ranting on Twitter.'
38
+ 'yukihiro matsumoto':
39
+ topic: 'Opening Keynote'
40
+ description: 'Yukihiro ''Matz'' Matsumoto is a programmer, and the creator of the Ruby language. He works for many open source related organizations and companies, e.g. NaCl inc. in Japan, Heroku and Ruby Association. Since his real name is difficult for non-Japanese speakers to pronounce correctly, he uses the nickname Matz on the Net. Matz spoke at RubyConfIndia 2016.'
41
+
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+ ruby '2.4.0'
3
+
4
+ gem 'puma'
5
+ gem 'pry'
6
+ gem 'bot_framework', path: '../../../bot_framework'
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ bot_framework (0.1.0beta)
5
+ chronic
6
+ chronic_duration
7
+ httparty
8
+ jwt
9
+ nio4r
10
+ oauth2
11
+ rack
12
+ rb-readline
13
+ timers
14
+
15
+ GEM
16
+ remote: https://rubygems.org/
17
+ specs:
18
+ chronic (0.10.2)
19
+ chronic_duration (0.10.6)
20
+ numerizer (~> 0.1.1)
21
+ coderay (1.1.1)
22
+ faraday (0.11.0)
23
+ multipart-post (>= 1.2, < 3)
24
+ hitimes (1.2.4)
25
+ httparty (0.14.0)
26
+ multi_xml (>= 0.5.2)
27
+ jwt (1.5.6)
28
+ method_source (0.8.2)
29
+ multi_json (1.12.1)
30
+ multi_xml (0.6.0)
31
+ multipart-post (2.0.0)
32
+ nio4r (2.0.0)
33
+ numerizer (0.1.1)
34
+ oauth2 (1.3.1)
35
+ faraday (>= 0.8, < 0.12)
36
+ jwt (~> 1.0)
37
+ multi_json (~> 1.3)
38
+ multi_xml (~> 0.5)
39
+ rack (>= 1.2, < 3)
40
+ pry (0.10.4)
41
+ coderay (~> 1.1.0)
42
+ method_source (~> 0.8.1)
43
+ slop (~> 3.4)
44
+ puma (3.8.2)
45
+ rack (2.0.1)
46
+ rb-readline (0.5.4)
47
+ slop (3.6.0)
48
+ timers (4.1.2)
49
+ hitimes
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ bot_framework!
56
+ pry
57
+ puma
58
+
59
+ RUBY VERSION
60
+ ruby 2.4.0p0
61
+
62
+ BUNDLED WITH
63
+ 1.14.6
@@ -0,0 +1,35 @@
1
+ BotFramework.configure do |connector|
2
+ connector.app_id = ENV['RUBY_CONF_MICROSOFT_APP_ID']
3
+ connector.app_secret = ENV['RUBY_CONF_MICROSOFT_APP_PASSWORD']
4
+ end
5
+
6
+ BotFramework::Bot.add_recognizer(BotFramework::Dialogs::RegExpRecognizer.new('HelpIntent', /^(help|options)/i))
7
+ BotFramework::Bot.add_recognizer(BotFramework::Dialogs::RegExpRecognizer.new('HelloIntent', /^(hi|hello|hai)/i))
8
+
9
+ BotFramework::Bot.on :activity do |activity|
10
+ # All activities
11
+ end
12
+
13
+ BotFramework::Bot.on :message do |activity|
14
+ # Call back for messages
15
+ end
16
+
17
+ BotFramework::Bot.on :ping do |activity|
18
+ # Callback for pings
19
+ end
20
+
21
+ BotFramework::Bot.on :typing do |activity|
22
+ # Callback for typing
23
+ end
24
+
25
+ BotFramework::Bot.on_intent 'HelpIntent' do |activity, _intents|
26
+ reply(activity, "<HELP TEXT HERE>")
27
+ end
28
+
29
+ BotFramework::Bot.on_intent 'HelloIntent' do |activity, _intents|
30
+ reply(activity, "Hello")
31
+ end
32
+
33
+ BotFramework::Bot.on_intent :default do |activity, _intents|
34
+ reply(activity, 'Unable to recognize')
35
+ end