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
HubotでIRC botをつくろう
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
mattak
July 23, 2014
Programming
650
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
HubotでIRC botをつくろう
Hubot勉強会 2014/07/23
mattak
July 23, 2014
More Decks by mattak
See All by mattak
人間はどこまでさぼれるか? AIコーディングで人の関与を計測してみた
mattak
0
3
最近やった作業環境改善施策10個
mattak
0
300
UnixTime is Simple
mattak
0
260
おっさんが停滞しないために
mattak
32
18k
tech invest
mattak
1
370
Nodux - node base redux framework
mattak
0
1.6k
what_is_technical_investment
mattak
0
180
unitypackage distribution
mattak
0
890
Unity energy usage
mattak
0
980
Other Decks in Programming
See All in Programming
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
12k
Webフレームワークの ベンチマークについて
yusukebe
0
160
TAKTでAI駆動開発の品質を設計する
j5ik2o
6
1.2k
Oxcを導入して開発体験が向上した話
yug1224
4
300
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
500
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
750
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
240
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
5
3.8k
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
250
RTSPクライアントを自作してみた話
simotin13
0
520
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
3.6k
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
Featured
See All Featured
Making Projects Easy
brettharned
120
6.7k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
200
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
390
WCS-LA-2024
lcolladotor
0
620
Building Adaptive Systems
keathley
44
3k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
Transcript
HubotͰ IRC BotΛͭ͘Ζ͏ 2014 / 07 / 23 @mattak
AGENDA 1. Hubot ͱʁ 2. Hubot ͷ࡞Γํ 3. Hubot ͰεΫϦϓτΛॻ͘
4. εΫϦϓτΛެ։͢Δ
Hubot?
Hubot? • Human + Robot = Hubot ? • GithubࣾͷChat
bot ! • ݴޠ: Coffeescript • ڥ: HipChat, IRC, Twitter, Gtalk, Skype, Linger,… • ύοέʔδཧ: npm
ಛ1: ͍ΖΜͳαʔϏεͰಈ͘
ಛ2: moduleԽͰ͖Δ Adapter tinyspec/hubot-slack nandub/hubot-irc miyagawa/hubot-lingr script hubot-ascii-faces hubot-cron hubot-yo
ಛ3: redisͰঢ়ଶཧ - BotΛ࠶ىಈͯ͠େৎ / / data set robot.brain.data[“user”] =
0; ! / / data save robot.brain.save();
Ͳ͏ͬͯ࡞Δ?
install -> create -> launch $ npm install -g hubot
coffee-script $ hubot —create myhubot $ cd myhubot $ bin/hubot —name myhubot myhubot> myhubot help …. default ͩͱShell্Ͱىಈ͠·͢ɻ
IRCͷରԠ $ npm install hubot-irc —save && npm install $
HUBOT_IRC_SERVER=irc.example.com \ HUBOT_IRC_ROOMS=“#room1,#room2” \ HUBOT_IRC_NICK=“myhubot” \ HUBOT_IRC_UNFLOOD=“true” \ bin/hubot -a irc —name myhubot HUBOT_IRC_SEND_NOTICE_MODE = “true” noticeͰͷىಈ
hubotͷݺͼํ myhubot> myhubot help myhubot> @myhubot help myhubot> MYHUBOT help
myhubot> myhubot: help
defaultͰ৭ʑͰ͖ΔΑ ը૾ Hubot> @Hubot image me ॅ఼ youtube: Hubot> @Hubot
youtube me ͪΐͬͱ͓࣌ؒΑΖ͍͠Ͱ͔͢ ݴޠม: Hubot> @Hubot translate me from japanese into english δϣδϣ Ξχϝʔγϣϯgif: Hubot> @Hubot animate me খࣉখ࡙
pluginͷΠϯετʔϧ $ npm install hubot-cron —save $ cat external-scripts.json [“hubot-cron”]
npm install ͯ͠ɺexternal-scripts.jsonʹهड़͢Δ͚ͩ.
scriptΛॻ͘ʂ
scripts $ ls scripts auth.coffee google-images.coffee httpd.coffee ping.coffee roles.coffee storage.coffee
youtube.coffee events.coffee help.coffee maps.coffee pugme.coffee rules.coffee translate.coffee ਅࣅ͠ͳ͕Βɺscripts/ ҎԼʹॻ͚OK.
scriptͷίϝϯτ https:/ /github.com/github/hubot-scripts#readme # Description # <description of the scripts
functionality> # # Dependencies: # "<module name>": "<module version>" # # Configuration: # LIST_OF_ENV_VARS_TO_SET # # Commands: # hubot <trigger> - <what the respond trigger does> # <trigger> - <what the hear trigger does> # # Notes: # <optional notes required for the script> # # Author: # <github username of the original script author> ॻ͘ͱhelpʹग़Δʂ
scriptͷத module.exports = (robot) -> robot.respond /PING$/i, (msg) -> msg.send
"PONG" ! robot.respond /ADAPTER$/i, (msg) -> msg.send robot.adapterName ! robot.respond /ECHO (.*)$/i, (msg) -> msg.send msg.match[1] ! robot.respond /TIME$/i, (msg) -> msg.send "Server time is: #{new Date()}" ! robot.respond /DIE$/i, (msg) -> msg.send "Goodbye, cruel world." process.exit 0
tips1 msg.send “Guten morgen!” ൃݴ͢Δ msg.reply “ͳΜͰͶΜʂ” ฦ͢Δ Hubot> @Hubot
tukkomi Hubot> Shell: “ͳΜͰͶΜʂ” Hubot> Guten morgen!
tips2 robot.hear /hear/i, (msg) -> msg.send “hear” Ԡ1 robot.respond /respond/i,
(msg) -> msg.send “respond” Ԡ2 Hubot> @Hubot hear Hubot> hear Hubot> @Hubot respond Hubot> respond Hubot> respond Hubot> hear Hubot> hear (respond: @Hubot Ͱ࢝ΊΔίϚϯυܥ) (hear: ҙԠܥ)
tips3 { "user": { "id": "1", "name": "Shell", "room": "Shell"
}, "text": "@Hubot test", "id": "messageId", "done": false, "room": "Shell" } ൃݴ༰: msg.message bot໊: robot.name
moduleԽͯ͠ެ։͢Δ!
࣮ࡍʹͭͬͯ͘Έͨ • https:/ /github.com/mattak/hubot-hello-ninja • https:/ /www.npmjs.org/package/hubot-hello-ninja ࢀߟ: • https:/
/github.com/sakatam/hubot-yo • https:/ /github.com/miyagawa/hubot-cron
؆୯Ͱ͢ ొ: $ npm adduser ެ։: $ npm publish ֬ೝ:
$ npm info hubot-hello-ninja ಈ࡞֬ೝ: $ npm install /your/module/path
HubotΦεεϝʂ ͲΜͲΜmoduleԽ͠Α͏ʂ
࣌ؒ͋ΔͷͰDEMO https:/ /github.com/mattak/ninja-bot