Skip to content

Instantly share code, notes, and snippets.

@tigercosmos
Created May 21, 2018 13:14
Show Gist options
  • Save tigercosmos/662b06cd55c8914d86ca2b4b18a75d56 to your computer and use it in GitHub Desktop.
Save tigercosmos/662b06cd55c8914d86ca2b4b18a75d56 to your computer and use it in GitHub Desktop.
// ...
// 一些預處理,抓地點、時間、氣象關鍵字等
// ...
} else if (isWeatherKeyword) { // 如果是要回應「天氣」況狀,例如:天氣、濕度、溫度
let replyMsg = ""; // 將回傳給使用者的資訊
// ...
if (isTimeKeyword) { // 如果有時間關鍵字,並且不是現在,就採用預報
replyMsg = await getForecast(); // 取得氣象預報資料
} else { // 不然就回答現在天氣
replyMsg = await getWeather(); // 取得現在氣象狀況
}
await platformReplyText(context, replyMsg); // 回傳給 Line 或 Messenger
} else if(/* 其他氣象關鍵字,例如:空氣品質、 */) {
// ....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment