Last year, I asked this question and received helpful answers. However, there is still a problem that I couldn't figure out. Since I am unable to comment on the previous answers, I have decided to add a new question
client.on('message', message => {
const text = message.content.replace(/:[^:\s]+:|<:[^:\s]+:[0-9]+>|<a:[^:\s]+:[0-9]+>/g, '').replace(/\s+/g, '');
if (text && message.channel.id === '772980333049020436') {
message.delete()
.catch(console.error);
}
})
I wrote this code and it seems to be working well for custom and animated emojis, as it successfully deletes text messages. However, default Discord emojis like :smile: are also getting deleted. How can I fix this issue?