I would like to clean all my channels and and I'm getting there. The problem is, it's very, very long ...
message.guild.channels.cache.forEach(c => {
if (c.isText()) {
let CompteurMessage = 0;
let CompteurSuppression;
c.messages.fetch().then(messages => {
messages.forEach(msg => {
msg.delete();
});
});
c.send(`Your server is the best, ${message.author}.`);
}
});
Do you have any idea how to go much faster, for example counting the number of messages in a channel ?
EDIT : Now, I clone the channels but they change places ...
c.clone().then((clone) => {
clone.send(`Love ${message.author}.`);
const originalPosition = c.position;
c.delete();
clone.setPosition(originalPosition);
});
Channels n°3 and 4 change their place.
Thank you