added post notes feature

This commit is contained in:
Win 2024-07-17 17:47:31 +07:00
parent b001e0215c
commit 6cf9b5cbbd
2 changed files with 3 additions and 32 deletions

View File

@ -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;

View File

@ -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);