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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
11
最近やった作業環境改善施策10個
mattak
0
310
UnixTime is Simple
mattak
0
270
おっさんが停滞しないために
mattak
32
19k
tech invest
mattak
1
370
Nodux - node base redux framework
mattak
0
1.6k
what_is_technical_investment
mattak
0
190
unitypackage distribution
mattak
0
890
Unity energy usage
mattak
0
990
Other Decks in Programming
See All in Programming
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
120
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
290
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
130
Vite+ Unified Toolchain for the Web
naokihaba
0
670
初めてのKubernetes 本番運用でハマった話
oku053
0
110
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1k
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
140
AIエージェントで 変わるAndroid開発環境
takahirom
1
430
dRuby over BLE
makicamel
2
410
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
130
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
450
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
290
Featured
See All Featured
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
220
Prompt Engineering for Job Search
mfonobong
0
370
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
490
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Embracing the Ebb and Flow
colly
88
5.1k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
240
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