as u can see name topic how do I make the .setImage change every update when i change the image without deleting a msg? or write cmd once again
my first attempt : I tried to make it by uploading the image from a hosting site and to get the image link and from there I change the image and then I used setInterval to update the line .setImage but did not work for me this is my code of first attempt
let exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
exampleEmbed.setImage('https://test.000webhostapp.com/images/image.jpg')
.setTimestamp()
try {
let message1 = await message.channel.send({ embeds: [exampleEmbed] });
setInterval(async function(){
let exampleEmbed2 = new MessageEmbed()
.setColor('#0099ff')
exampleEmbed2.setImage('https://test.000webhostapp.com/images/image.jpg')
console.log('updated')
await message1.edit({ embeds: [exampleEmbed2] })
},7000)
} catch(err) {
console.log(err)
}
my second attempt was from the local computer I used MessageAttachment to get me the file path of image and then I also used setInterval to update the line function inside .setImage + MessageAttachment every 7 seconds it didn’t work either. Although when I type the command again, the (updated) image appears on the second try
here is my codes try second attempt
let exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
exampleEmbed.setImage('https://test.000webhostapp.com/images/image.jpg')
.setTimestamp()
try {
let message1 = await message.channel.send({ embeds: [exampleEmbed] });
setInterval(async function(){
let exampleEmbed2 = new MessageEmbed()
const attachement = new MessageAttachment('./images/image.jpg','image.jpg');
.setColor('#0099ff')
exampleEmbed2.setImage('attachment://image.jpg')
console.log('updated')
await message1.edit({ embeds: [exampleEmbed2], files: [attachement] })
},7000)
} catch(err) {
console.log(err)
}
Is there another way please? i would like to do the image update sync in any way without restart the bot or even writing cmd again