This commit is contained in:
Win 2024-06-25 19:25:03 +07:00
parent d0df64b48f
commit 4c4db68a03
1 changed files with 8 additions and 7 deletions

View File

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