Help us understand the problem. What is going on with this article?

オフィス周辺にポケモンが現れたら Slack チャンネルに通知するようにした

More than 3 years have passed since last update.

タイトル通りにオフィス周辺(半径変更可)にポケモンが現れたらSlackのチャンネルに通知するようにしてみた。

packge.jsonに pokego-scan 追加

{
  "dependencies": {
    "pokego-scan": "0.1.5"
  }
}

pokemon-go.coffee 作ってhubotのscriptsに入れる。

cronJob = require('cron').CronJob
pokegoScan = require('pokego-scan')

# 自分の環境合わせて設定してください(http://www.latlong.net)
coords = {
    latitude: 35.664134,
    longitude: 139.713854
};

module.exports = (robot) ->
  cronjob = new cronJob('*/5 * * * *', () =>
    channel = room: "#pokemon" # 自分の環境に合わせて変更
    pokegoScan coords, { distance: 50 }, (err, pokemons) ->
      if pokemons != undefined
        message = ""
        pokemons.forEach (pokemon) ->
          message += pokemon.name + "\n"
          message += pokemon.despawns_in_str + "\n"
          message += pokemon.image + "\n"
        if message != ""
          robot.send channel, message
  )
  cronjob.start()

Screen Shot 2016-07-26 at 6.00.32 PM.png

こんな感じで通知してくれます。
二行目の数字は、ポケモンが消えるまでの時間です。

その後

Screen Shot 2016-07-26 at 6.00.32 PM.png

追記(2016-07-27)

https://github.com/dgoguerra/pokego-scan
https://www.npmjs.com/package/pokego-scan

パッケージと開発がクローズされたみたいです、、、

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした