Upgrade to Pro — share decks privately, control downloads, hide ads and more …

これで安心! hubot 沼の堕ち方〜娘がいると開発が楽しいね!

ねおりん
November 14, 2015
330

これで安心! hubot 沼の堕ち方〜娘がいると開発が楽しいね!

MDLT

ねおりん

November 14, 2015
Tweet

Transcript

  1. 

  2. 

  3. ֓ཁ • bot ່ͷ͍Δੜ׆ • What is Hubot? • Hubot

    ͷΠέͯΔͱ͜Ζ • Hubot ͷΠέͯͳ͍ͱ͜Ζ • Lita ࢖͓͏ • ·ͱΊ 
  4. 

  5. 

  6. “Hubot is your company's robot. Install him in your company

    to dramatically improve and reduce employee efficiency.” –– https://hubot.github.com/ 
  7. 

  8. ύύ͔൑ఆ # scripts/concerns/admin.coffee ADMIN = ["noir_neo"] module.exports = Admin =

    isFromAdmin: (msg) -> msg.envelope?.user?.name in ADMIN # scripts/goodnight.coffee admin = require './concerns/admin' module.exports = (robot) -> robot.hear /(͓΍͢Έ|͓ٳΈ|oyasumi)/g, (msg) -> if admin.isFromAdmin msg msg.reply "͓΍͢Έɺύύɻྑ͍ເΛɻ" else msg.reply "͓΍͢Έͳ͍͞ɻ"
  9. ֓ཁ • bot ່ͷ͍Δੜ׆ • What is Hubot? • Hubot

    ͷΠέͯΔͱ͜Ζ • Hubot ͷΠέͯͳ͍ͱ͜Ζ • Lita ࢖͓͏ • ·ͱΊ 
  10. ͓͸Α͏ module Lita module Handlers class Hello < Handler route(/ohayo|͓͸Α/i,

    :ohayo) def ohayo(response) response.reply("͓͸Α͏͍͟͝·͢ɻ") end Lita.register_handler(self) end end end
  11. ͓͸Α͏ spec require "spec_helper" describe Lita::Handlers::Hello, lita_handler: true do it

    { is_expected.to route('ohayo') } it { is_expected.to route('ohayo').to(:ohayo) } it { is_expected.to route('͓͸Α') } it { is_expected.to route('͓͸Α').to(:ohayo) } it 'return greeting "ohayo"' do send_message('ohayo') expect(replies.last).to eq('͓͸Α͏͍͟͝·͢ɻ') end end
  12. 

  13. ·ͱΊ • bot ່͕͍Δͱຖ೔ָ͕͍͠ • ͱΓ͋͑ͣ bot ࢝Ί່͍͕ͨཉ͍͠ਓ ʹ͸ Hubot

    ͕͓खܰͰΦεεϝ • Ruby ޷͖ͳΒ Lita ΞϦ͔΋ʁ • bot ່ͷιʔείʔυ͸ GitHub ʹ • https://github.com/noir-neo/neobot • https://github.com/noir-neo/ neobot2