LoginSignup
18
17

More than 5 years have passed since last update.

我が家を支えるChatOps

Last updated at Posted at 2015-07-10

この記事はHubot Advent Calendar 2014の15日目です。

我が家でやり始めたchatopsのことを書こうと思います。

家族構成

  • 私、嫁の二人暮らし
  • 共働き
  • 私:めんどくさがり
  • 嫁:めんどくさがり

巻き起こる問題

  • どっちがゴミ捨てる問題
  • どっちが洗濯、掃除するか問題
  • どっちがシャンプーとか詰め替えるか問題

お互いめんどくさがりなので、
毎回、ギリギリまで耐えて相手にやらせようと戦っています

その結果

  • 貯まるゴミ、洗濯モノ・・・

これはイカン!

ということで、
家庭内問題解決のためChatOpsやってみました。

ゴミ出しBot作った

毎日夕方に明日出すゴミとその担当をチャットに流します。

20141215111852.png

って感じでゴミ出し当番を回すようにしています。
毎回この通りにやっているわけではないですが、以前よりはよくなったような。

ソースはこんな感じです。

persons = ['夫','嫁']
week = ["日","月","火","水","木","金","土"]
garbage_config = ["燃えるゴミ","ビン缶ペットボトル","燃えるゴミ","燃えないゴミ","燃えるゴミ","燃えるゴミ","燃えないゴミ"]


module.exports = (robot) ->

  #gabage
  new cron
    cronTime: "0 0 21 * * *"
    start: true
    timeZone: "Asia/Tokyo"
    onTick: ->
      now = new Date()
      target_day = now.getDay() + 1
      rand_num = (Math.floor(Math.random() * 100) + 1) % persons.length
      if target_day > week.length
        target_day = 0
      winner = persons[rand_num]
      robot.send {room: "xxxxxxx@conf.hipchat.com"}, "明日の#{week[target_day]}曜は#{garbage_config[target_day]}の日ですー!\n担当は#{winner}ですん"

チーム運用の改善に利用されるChatOpsですが、
今回は家庭運用に使ってみました。

家族も重要なチームと捉えれば色々改善できそうなとこありそうですね!

同じネタで社内LTをやったので、
その時のスライドも貼っておきます!





感謝致します。

18
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
17