Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Chatterbot
Search
Tomohiro Taira
December 04, 2012
Programming
0
460
Chatterbot
I'm created the Kris. Kris is a Ruby IRC bot library.
https://github.com/Tomohiro/kris
Tomohiro Taira
December 04, 2012
Tweet
Share
More Decks by Tomohiro Taira
See All by Tomohiro Taira
Go Package Development
tomohiro
1
1.1k
Awesome LAMP
tomohiro
1
410
Other Decks in Programming
See All in Programming
CSC509 Lecture 13
javiergs
PRO
0
110
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
890
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
RubyLSPのマルチバイト文字対応
notfounds
0
120
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Better Code Design in PHP
afilina
PRO
0
130
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
240
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
A designer walks into a library…
pauljervisheath
204
24k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Agile that works and the tools we love
rasmusluckow
327
21k
Gamification - CAS2011
davidbonilla
80
5k
How to train your dragon (web standard)
notwaldorf
88
5.7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Transcript
Chatterbot Support your development team
@Tomohiro twitter.com/ github.com/ coderwall.com/
@Tomohiro ࢲͩ
@gongoZ ͝Μ͝͞Μͩ
Recent... 1. Became mayer of Ruby in coderwall.com 2. Got
over 95 upvotes at protip in coderwall.com 3. AirPlayer in popularity (github, coderwall ...)
Recent... 1. Became mayer of Ruby in coderwall.com 2. Got
over 95 upvotes at protip in coderwall.com 3. AirPlayer in popularity (github, coderwall ...)
Recent... 1. Became mayer of Ruby in coderwall.com 2. Got
over 95 upvotes at protip in coderwall.com 3. AirPlayer in popularity (github, coderwall ...)
Recent... 1. Became mayer of Ruby in coderwall.com 2. Got
over 95 upvotes at protip in coderwall.com 3. AirPlayer in popularity (github, coderwall ...)
Recent... 1. Became mayer of Ruby in coderwall.com 2. Got
over 95 upvotes at protip in coderwall.com 3. AirPlayer in popularity (github, coderwall ...) current: 4th!!
Chatterbot a.k.a ਓޱແೳ
Chatterbot A chatter robot, chatterbot, chatbot, or chat bot is
a computer program designed to simulate an intelligent conversation with one or more human users via auditory or textual methods, primarily for engaging in small talk. - via Wikipedia chatterbot
ਓޱແೳ ਓແʢ͡Μ͜͏Ήͷ͏ʣͱɺਓೳʹରԠ ͢Δ༻ޠͰɺӳޠݍͰDIBUUFSCPUɺ͘͠ DIBUCPUͱݺΕɺͦͷ༁ޠͱͯ͠ձϘοτ͋ Δ͍͓͠ΌΓϘοτͱݺΕΔ͜ͱ͕͋Δɻ 8JLJQFEJBਓޱແೳΑΓ
ਓޱೳ ϘτϜΞοϓతͳਓೳͷΞϓϩʔνͰʮਓΒ͠ ͞ʯʹ౸ୡ͢Δ·ͰͷಓͷΓ͕ԕ͍ͷͰɺτοϓμϯ తʹʮਓΒ͠͞ʯͷϞσϧΛ࡞Γ͜Ή͜ͱͰʮਓΒ͠ ͞ʯΛ࡞Γग़ͦ͏ͱ͢Δཱɻ͓ΑͼͦͷཱͰ࡞ΒΕ ͨγεςϜɾϞσϧɾιϑτΣΞͳͲΛࢦ͢ɻ 8JLJQFEJBਓޱແೳΑΓ
Chatterbot on ... ɾChat system (IRC, Campfire, HipChat, and more...)
ɾWeb Service (Twitter, Yammer, and more...) ɾIM (Skype, Google IM, and more...)
Chatterbot on ... ɾChat system (IRC, Campfire, HipChat, and more...)
ɾWeb Service (Twitter, Yammer, and more...) ɾIM (Skype, Google IM, and more...)
Chatterbot on ... ɾChat system (IRC, Campfire, HipChat, and more...)
ɾWeb Service (Twitter, Yammer, and more...) ɾIM (Skype, Google IM, and more...)
Chatterbot on ... ɾChat system (IRC, Campfire, HipChat, and more...)
ɾWeb Service (Twitter, Yammer, and more...) ɾIM (Skype, Google IM, and more...)
Chatterbot softwares... ɾHubot (Node.js) ɾCinch (Ruby) ɾikachan (Perl)
Chatterbot softwares... ɾHubot (Node.js) ɾCinch (Ruby) ɾikachan (Perl)
Chatterbot softwares... ɾHubot (Node.js) ɾCinch (Ruby) ɾikachan (Perl)
Chatterbot softwares... ɾHubot (Node.js) ɾCinch (Ruby) ɾikachan (Perl)
Chatterbot softwares... ɾHubot (Node.js) ɾCinch (Ruby) ɾikachan (Perl) And many
more !!
νʔϜͷ
20125݄HubotΛ࠾༻
Hubot ࠾༻ͨ͠ཧ༝ ɾGitHub ɾ๛ͳϓϥάΠϯ ɾNode.js & CoffeeScript͕؆୯ͦ͏ ɾHerokuʹσϓϩΠͰ͖Δ
Hubot ࠾༻ͨ͠ཧ༝ ɾGitHub ɾ๛ͳϓϥάΠϯ ɾNode.js & CoffeeScript͕؆୯ͦ͏ ɾHerokuʹσϓϩΠͰ͖Δ
Hubot ࠾༻ͨ͠ཧ༝ ɾGitHub ɾ๛ͳϓϥάΠϯ ɾNode.js & CoffeeScript͕؆୯ͦ͏ ɾHerokuʹσϓϩΠͰ͖Δ
Hubot ࠾༻ͨ͠ཧ༝ ɾGitHub ɾ๛ͳϓϥάΠϯ ɾNode.js & CoffeeScript͕؆୯ͦ͏ ɾHerokuʹσϓϩΠͰ͖Δ
Hubot ࠾༻ͨ͠ཧ༝ ɾGitHub ɾ๛ͳϓϥάΠϯ ɾNode.js & CoffeeScript͕؆୯ͦ͏ ɾHerokuʹσϓϩΠͰ͖Δ
Hubot ΛࣾͰར༻ͯ͠Έͯ... ɾϓϩΩγڥԼͰ֎෦௨৴ग़དྷͳ͍ ɾϓϥάΠϯ࡞࣌ʹςετॻ͚ͳ͍ ɾHerokuʹσϓϩΠ͢Δબࢶ͕ͳ͍
Hubot ΛࣾͰར༻ͯ͠Έͯ... ɾϓϩΩγڥԼͰ֎෦௨৴ग़དྷͳ͍ ɾϓϥάΠϯ࡞࣌ʹςετॻ͚ͳ͍ ɾHerokuʹσϓϩΠ͢Δબࢶ͕ͳ͍
Hubot ΛࣾͰར༻ͯ͠Έͯ... ɾϓϩΩγڥԼͰ֎෦௨৴ग़དྷͳ͍ ɹˠ๛ͳϓϥάΠϯ͕͑ͳ͍ ɾϓϥάΠϯ࡞࣌ʹςετॻ͚ͳ͍ ɾHerokuʹσϓϩΠ͢Δબࢶ͕ͳ͍
Hubot ΛࣾͰར༻ͯ͠Έͯ... ɾϓϩΩγڥԼͰ֎෦௨৴ग़དྷͳ͍ ɹˠ๛ͳϓϥάΠϯ͕͑ͳ͍ ɾϓϥάΠϯ࡞࣌ʹςετॻ͚ͳ͍ ɾHerokuʹσϓϩΠ͢Δબࢶ͕ͳ͍
Hubot ΛࣾͰར༻ͯ͠Έͯ... ɾϓϩΩγڥԼͰ֎෦௨৴ग़དྷͳ͍ ɹˠ๛ͳϓϥάΠϯ͕͑ͳ͍ ɾϓϥάΠϯ࡞࣌ʹςετॻ͚ͳ͍ ɹˠ؆୯ʹϓϥάΠϯ͕ॻ͚ͳ͍ ɾHerokuʹσϓϩΠ͢Δબࢶ͕ͳ͍
Hubot ΛࣾͰར༻ͯ͠Έͯ... ɾϓϩΩγڥԼͰ֎෦௨৴ग़དྷͳ͍ ɹˠ๛ͳϓϥάΠϯ͕͑ͳ͍ ɾϓϥάΠϯ࡞࣌ʹςετॻ͚ͳ͍ ɹˠ؆୯ʹϓϥάΠϯ͕ॻ͚ͳ͍ ɾHerokuʹσϓϩΠ͢Δબࢶ͕ͳ͍
Hubot ΛࣾͰར༻ͯ͠Έͯ... ɾϓϩΩγڥԼͰ֎෦௨৴ग़དྷͳ͍ ɹˠ๛ͳϓϥάΠϯ͕͑ͳ͍ ɾϓϥάΠϯ࡞࣌ʹςετॻ͚ͳ͍ ɹˠ؆୯ʹϓϥάΠϯ͕ॻ͚ͳ͍ ɾHerokuʹσϓϩΠ͢Δબࢶ͕ͳ͍ ɹˠࣾωοτϫʔΫʹͭͳ͍͛ͨ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ
νʔϜʹඞཁͳͷ... ɾIRCαʔόʹଓͯ͠ಈ࡞͢Δ ɾϓϩΩγڥԼͰಈ࡞ ɾϓϥάΠϯͰػೳΛ૿ͤΔ ɾϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ɾΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ɾԠػೳͱఆظൃݴػೳΛ࣋ͭ 3VCZͰ ɹɹॻ͚ͦ͏ʂ
࡞Γ·ͨ͠ ઌि
Kris Pluggable, and very simple. https://github.com/Tomohiro/kris depend on ‘zircon’. Thanks
to @r7kamura
ࠓग़དྷΔ͜ͱ ✓ϓϩΩγڥԼͰಈ࡞ ✓ϓϥάΠϯͰػೳΛ૿ͤΔ ✗ϓϥάΠϯΛॻ࣌͘ʹ୯ମςετॻ͚Δ ✓ΦʔϓϯιʔεϥΠϒϥϦۃྗར༻͍ͨ͠ ✓ԠػೳͱఆظൃݴػೳΛ࣋ͭ
kris example project /mybot/ |-- Gemfile ґଘؔΛॻ͘ |-- bot Bot
ىಈϓϩάϥϜ `-- plugin ϓϥάΠϯ༻σΟϨΫτϦ |-- foo.rb `-- bar.rb
Bootstrap #!/usr/bin/env ruby require ‘kris’ Kris::Session.new( :server => ‘chat.freenode.net’, :port
=> 6667, :channel => ‘#MyChannel’, :username => ‘KrisBot’ ).start
Plugin example # Hello ͱ͍͏ൃݴʹ Hello! ͱฦ͢Δྫ class Reply <
Kris::Plugin def response(message) if message.body =~ /^Hello/ notice(message.to, ‘Hello!’) end end end
Plugin example # 1͝ͱʹݱࡏ࣌ࠁΛͭͿ͘ class Timer < Kris::Plugin def notify
notice(@robot.channel, Time.now.to_s) sleep 60 end end
TODO ɾϥΠϒϥϦͷςετॻ͘ ɾϓϥάΠϯͷςετख๏Λཱ֬ ɾRubyGems.orgʹϦϦʔε͢Δ
͓·͚ - Heroku Ͱಈ͘Αฤ $ cd my-bot $ echo ‘bot:
bundle exec ruby bot’ > Procfile $ heroku create {my-bot-name} $ git commit -a -m ‘my bot on heroku’ $ git push heroku master $ heroku ps:scale bot=1
Any Questions?