Skip to content

cochiachang/weather-bot

 
 

Repository files navigation

氣象機器人 Weather Bot

Build Status

使用 messenger 和 line bot 實作的氣象機器人,用來自動回應有關天氣的訊息

Using messenger and line bot to implement weather rebot, in order to tell weather information to users automatically.

對此專案有興趣的話,可以閱讀這篇:來寫個氣象機器人吧!

bot_home

Use the bot

For Messenger

Link: http://m.me/weather.bot.tw/

demo_messenger

For Line

Add the bot via QR code or click the button below

QRcode

加入好友

Demo

demo_enter

demo1

demo2

demo3

demo4

Document 文件

請對我輸入指令(回覆我以下的關鍵字)
目前支援指令,以及其說明:

【快速使用】
- 預報(圖)
- 地震(圖)
- 空氣品質(圖)
- 衛星雲圖(圖)
- [地區]天氣(例如:東京天氣)
- [縣市][時間]預報 (例如:明天晚上台北預報)
- [縣市]概況(例如:台北概況)
- [地區]空氣(例如:北京空氣)
 
【進階指令】
<地區天氣>:直接查詢地區的天氣狀況(支援英文查詢國外地區)
 *[地址]天氣:取得地區氣象數據
    例如:高雄市天氣、淡水天氣
         new york 天氣、東京天氣

 *[縣市][時間]天氣:取得縣市預報
    例如:明天台中天氣、明天17:00台南天氣

 *[縣市]概況:臺灣的縣市天氣概況
    例如:全臺概況、金門縣概況

<預報>:台灣縣市預報
 *預報:取得台灣地區預報圖

 *[縣市][時間]預報
    例如:明天晚上台北預報
 *[縣市][未來時間]天氣
    例如:明天台中天氣、明天17:00台南天氣

 註:目前只支援 7 天內台灣縣市預報

<氣象圖>:提供氣象圖的連結
 *空汙
 *預報
 *天氣圖
 *衛星雲
 *雷達

<氣象觀測站>:查詢單一測站的詳細數據
 *[觀測站名稱]觀測
    例如:宜蘭觀測、士林觀測
 *觀測站清單:用來查詢有哪些觀測站

<空氣品質查詢>:查詢地區或測站空氣資訊
 *[地區]空氣
    例如:紐約空氣、北京空氣、台北空氣
 *[監測站名稱]空氣
    例如:基隆空氣、淡水空氣
 *監測站清單:用來查詢有哪些台灣監測站

<其他>
 *氣象局/CWB
 *回報問題/issue
 *Github/原始碼

Develop 開發

Currently this repo is connecting with:

The bot use webhook to receive message and reply to users.

The two bot are synced to master.

For more detail about line bot, can visit https://developers.line.me/

How to test

Console mode testing

Console mode is an interactive mode that you can test in local.

node . console

Test the real bot

Test bot(line) link: https://line.me/R/ti/p/pOGQWj-4j-

Steps:

  1. add the test line bot above as friend
  2. send a PR
  3. ask @tigercosmos to help you call the bot

For user IDs in white list, create comment bot try in PR.

Heroku

see https://github.com/Automattic/node-canvas/wiki/Installation-on-Heroku

./Aptfile, app.json is for Heroku.

Setup

Dependencies

node-canvas

Linux:

sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++

MacOS:

brew install pkg-config cairo pango libpng jpeg giflib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PATH="/usr/local/opt/icu4c/bin:$PATH
export PATH="/usr/local/opt/icu4c/sbin:$PATH
cp /usr/local/Cellar/libpng/1.6.34/lib/pkgconfig/libpng.pc /usr/local/lib/pkgconfig
cp /usr/local/Cellar/fontconfig/2.12.6/lib/pkgconfig/fontconfig.pc /usr/local/lib/pkgconfig

Run

Make sure npm and nodeJS(require above version 7.6) have installed.

git clone https://github.com/weather-bot/weather-bot
cd weather-bot
npm install
npm start

Developer

License

MIT

About

氣象機器人 Weather Bot implement on Messenger and Line

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%