This commit is contained in:
Win 2024-06-30 11:20:48 +07:00
parent 1ae871f3fb
commit 8ccfcf2d5e
1 changed files with 101 additions and 83 deletions

View File

@ -111,10 +111,26 @@ client.on('ready', () => {
console.log("Current: " + curr_image_size); console.log("Current: " + curr_image_size);
console.log("New: " + radar_image_size); console.log("New: " + radar_image_size);
if(radar_image_size != curr_image_size) { if (radar_image_size != curr_image_size) {
console.log("File change detected!"); console.log("File change detected!");
const delete_msg = await channel.messages.delete(message_id); channel.messages
.fetch(sentMessage.id)
.then((fetchedMessage) => {
console.log('Message exists');
fetchedMessage
.delete()
.then(() => console.log('Message deleted successfully'))
.catch((err) => console.log('Could not delete the message', err));
})
.catch((err) => {
if (err.httpStatus === 404) {
console.log('Message already deleted');
} else {
console.log(err);
}
});
let date = new Date().toLocaleString('th-TH'); let date = new Date().toLocaleString('th-TH');
@ -134,6 +150,8 @@ client.on('ready', () => {
threadId: config.history, threadId: config.history,
}); });
console.log(`Sent message to history`) console.log(`Sent message to history`)
} else { } else {
console.log("No change in data, go on."); console.log("No change in data, go on.");
} }