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

@ -114,7 +114,23 @@ client.on('ready', () => {
if (radar_image_size != curr_image_size) {
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');
@ -134,6 +150,8 @@ client.on('ready', () => {
threadId: config.history,
});
console.log(`Sent message to history`)
} else {
console.log("No change in data, go on.");
}