Trying to delete messages that don't contain images and it's not deleting them

Why doesn't this work? There are no errors in the console
8 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Kelvin
Kelvin6mo ago
treble/luna
treble/luna6mo ago
#djs-questions next time please also, you can just check the size of the collection
Kelvin
Kelvin6mo ago
Sorry. Like this?
if (message.channel.id === '1189395457416376471') {
if (message.attachments.size === 0) {
message.delete();
}
}
if (message.channel.id === '1189395457416376471') {
if (message.attachments.size === 0) {
message.delete();
}
}
That doesn't work either
treble/luna
treble/luna6mo ago
do you have the MessageContent intent and GuildMessages
Kelvin
Kelvin6mo ago
Yep
d.js docs
d.js docs6mo ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. - Once you do, log relevant values and if-conditions - More sophisticated debugging methods are breakpoints and runtime inspections: learn more
!"Unkown
!"Unkown6mo ago
what event are u listening to?