var text = message.text;
var g = '@DedTime_Bot';
var uptime = Date.now() - start;
//高雄
var request = require("request");
var cheerio = require("cheerio");
var url = "
https://www.wunderground.com/q/zmw:00000.1.46740";
request(url, function (error, response, body) {
if (!error) {
var $ = cheerio.load(body);
var ks = [];
ks[1] = $("[data-variable='temperature'] .wx-value").html();
ks[2] = $("[data-variable='feelslike'] .wx-value").html();
ks[3] = $("[data-variable='pressure'] .wx-value").html();
ks[4] = $("[data-variable='visibility'] .wx-value").html();
ks[5] = $("[data-variable='humidity'] .wx-value").html();
ks[6] = $("[data-variable='precip_today'] .wx-value").html();
}
//台北
var request1 = require("request");
var cheerio1 = require("cheerio");
var url1 = "
https://www.wunderground.com/q/zmw:00000.1.58968";
request1(url1, function (error, response, body) {
if (!error) {
var $1 = cheerio1.load(body);
var tp = []
tp[1] = $1("[data-variable='temperature'] .wx-value").html();
tp[2] = $1("[data-variable='feelslike'] .wx-value").html();
}
var time = [];
time[1] = new Date().getHours();
time[2] = new Date().getMinutes();
time[3] = new Date().getSeconds();
time[4] = new Date().getFullYear();
time[5] = new Date().getMonth();
time[6] = new Date().getDate();
var M = [];
m[1] = Math.round((ks[2] - 32) * 5 / 9),
m[2] = Math.round((ks[1] - 32) * 5 / 9),
m[3] = Math.round(uptime / 1000),
m[4] = Math.round(ks[3] * (3386 / 100)),
m[5] = Math.round(ks[4]),
m[6] = Math.round((tp[1] - 32) * 5 / 9),
m[7] = Math.round((tp[2] - 32) * 5 / 9);
var fs = [];
fs[0] = require('fs');
fs[1] = message.from.first_name;
fs[2] = message.from.last_name;
fs[3] = message.from.username;
fs.appendFile(__dirname + '/Log.txt', ((time[1] + 32) % 24) + ' : ' + time[2] + ' : ' + time[3] + ' || ' + fs[1] + '_' + fs[2] + ' <' + fs[3] + '>' + ' -----> ' + text + '\n', function(error) {
if(error){
console.log('File write error');
}
/*