From 4c4db68a034fcdf73fe74a39a05c995ba3ba5f1a Mon Sep 17 00:00:00 2001 From: Win Date: Tue, 25 Jun 2024 19:25:03 +0700 Subject: [PATCH] publish --- src/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 3c46b42..2591312 100644 --- a/src/index.js +++ b/src/index.js @@ -34,7 +34,8 @@ client.once(Events.ClientReady, readyClient => { async function get_rain_image() { try { - const radar_image = await axios.get('https://weather.bangkok.go.th/Images/Radar/radar.gif', { + let radar_src = "https://weather.bangkok.go.th/Images/Radar/radarh.jpg" + const radar_image = await axios.get(radar_src, { responseType: "stream" }); @@ -55,7 +56,7 @@ async function get_radar_caption() { return root.querySelector('#repeaDaily_lblDESCRIPTION_0').childNodes[0]._rawText; } -const curr_image_path = path.resolve("data", "current_radar.gif"); +const curr_image_path = path.resolve("data", "current_radar.jpg"); client.on('ready', () => { (async () => { @@ -76,11 +77,11 @@ client.on('ready', () => { let date = new Date().toLocaleString('th-TH'); - let caption = `# Raindar Update\n## ${date}\n${radar_caption}\n\nImages: GIF (left) - Static Image (right)` + let caption = `# Raindar Update\n## ${date}\n${radar_caption}\n\nLeft: Current Observation\nRight: 3 hour forecast` let message = await channel.send({ content: caption, - files: [curr_image_path, "https://weather.bangkok.go.th/Images/Radar/radarh.jpg"] + files: [curr_image_path, "https://dds.bangkok.go.th/Radar/radar_rain.gif"] }); let message_id = message.id; @@ -88,7 +89,7 @@ client.on('ready', () => { await webhook.send({ content: caption, - files: [curr_image_path, "https://weather.bangkok.go.th/Images/Radar/radarh.jpg"], + files: [curr_image_path, "https://dds.bangkok.go.th/Radar/radar_rain.gif"], threadId: config.history, }); console.log(`Sent message to history`) @@ -122,7 +123,7 @@ client.on('ready', () => { let message = await channel.send({ content: caption, - files: [curr_image_path, "https://weather.bangkok.go.th/Images/Radar/radarh.jpg"] + files: [curr_image_path, "https://dds.bangkok.go.th/Radar/radar_rain.gif"] }); console.log(`Sent ${message.id}: ${message.content}`); @@ -130,7 +131,7 @@ client.on('ready', () => { await webhook.send({ content: caption, - files: [curr_image_path, "https://weather.bangkok.go.th/Images/Radar/radarh.jpg"], + files: [curr_image_path, "https://dds.bangkok.go.th/Radar/radar_rain.gif"], threadId: config.history, }); console.log(`Sent message to history`)