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