diff --git a/src/api/fetch.cjs b/src/api/fetch.cjs index 40df321..d0e1a6c 100644 --- a/src/api/fetch.cjs +++ b/src/api/fetch.cjs @@ -22,6 +22,5 @@ async function get_radar_caption() { return root.querySelector('#repeaDaily_lblDESCRIPTION_0').childNodes[0]._rawText; } - module.exports.get_radar_image = get_radar_image; module.exports.get_radar_caption = get_radar_caption; \ No newline at end of file diff --git a/src/index.js b/src/index.js index a71d56e..6426958 100644 --- a/src/index.js +++ b/src/index.js @@ -78,11 +78,10 @@ app.get('/callback', function(req, res) { /* let curr_image_path = path.join(__dirname, '/data/' + date + '.jpg'); */ let static_radar_path = path.join(__dirname, '/data/current_radar.jpg'); - let static_radar_image_name = `${raw_date.toISOString}.jpg`; - console.log(static_radar_image_name) + let static_radar_image_name = `${raw_date.toISOString()}.jpg`; const upload_radar_image = await Post.create_image(host, access_token, static_radar_image_name, static_radar_path); - let note_caption = `# Raindar Update\n## ${raw_date.toLocaleString('th-TH')}\nLeft: Current Observation\nRight: 3 hour forecast` + let note_caption = `$[x2 Bangkok Raindar Update]\n**${raw_date.toLocaleString('th-TH')}**\nLeft: Current Observation\nRight: 3 hour forecast` const post_note = await Post.create_note( host, access_token, @@ -91,35 +90,8 @@ app.get('/callback', function(req, res) { "public" ) - // setInterval(post, 30000); + setInterval(post, 60000); })(); - - /* setInterval(async function post() { - let static_radar_path = path.join(__dirname, '/data/current_radar.jpg'); - const static_radar_image = await Post.create_image(host, access_token, static_radar_path); - const static_radar_image__id = static_radar_image.data.id; - console.log(static_radar_image__id); - - return ; - }, 60000); */ - - /* setInterval(async () => { - let date = new Date().toLocaleString('th-TH'); - /* let curr_image_path = path.join(__dirname, '/data/' + date + '.jpg'); - - let static_radar_path = path.join(__dirname, '/data/current_radar.jpg'); - const static_radar_image = Post.create_image(host, access_token, name, static_radar_path); - const static_radar_image__id = static_radar_image.data.id; - - let note_caption = `# Raindar Update\n## ${date}\n${radar_caption}\n\nLeft: Current Observation\nRight: 3 hour forecast` - const post_note = Post.create_note( - host, - access_token, - note_text, - [static_radar_image__id], - "public" - ) - }, 60000); */ })(); app.listen(port);