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.2k
Awesome LAMP
tomohiro
1
410
Other Decks in Programming
See All in Programming
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Recoilを剥がしている話
kirik
5
6.6k
42 best practices for Symfony, a decade later
tucksaun
1
180
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
260
menu基盤チームによるGoogle Cloudの活用事例~Application Integration, Cloud Tasks編~
yoshifumi_ishikura
0
110
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
たのしいparse.y
ydah
3
120
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Building Applications with DynamoDB
mza
91
6.1k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Building Flexible Design Systems
yeseniaperezcruz
327
38k
KATA
mclloyd
29
14k
The Cult of Friendly URLs
andyhume
78
6.1k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
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?