testing
This commit is contained in:
parent
1ae871f3fb
commit
8ccfcf2d5e
22
src/index.js
22
src/index.js
|
@ -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.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue