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
450
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
Dev ContainersとGitHub Codespacesの素敵な関係
ymd65536
1
130
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
480
GCCのプラグインを作る / I Made a GCC Plugin
shouth
1
150
qmuntal/stateless のススメ
sgash708
0
120
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.7k
リリース8年目のサービスの1800個のERBファイルをViewComponentに移行した方法とその結果
katty0324
5
3.6k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
390
Vaporモードを大規模サービスに最速導入して学びを共有する
kazukishimamoto
4
4.3k
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.2k
Progressive Web Apps für Desktop und Mobile mit Angular (Hands-on)
christianliebel
PRO
0
110
Kotlin2でdataクラスの copyメソッドを禁止する/Data class copy function to have the same visibility as constructor
eichisanden
1
130
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
200
Featured
See All Featured
Building Your Own Lightsaber
phodgson
102
6k
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
How STYLIGHT went responsive
nonsquared
95
5.2k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
22k
Speed Design
sergeychernyshev
24
570
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
The Language of Interfaces
destraynor
154
24k
Scaling GitHub
holman
458
140k
RailsConf 2023
tenderlove
29
880
Practical Orchestrator
shlominoach
186
10k
It's Worth the Effort
3n
183
27k
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?