Message.attachments.size or Message.embeds.length always returning 0

Hi all, currently trying to check if a message contains an image. Using the messageCreate hook.
8 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
if (message.channelId !== channelId) {
return;
}

// always 0, 0
console.log(message.embeds.length, message.attachments.size);

// should only allow images in the channel
if (message.attachments.size === 0) {
await message.delete();
}
if (message.channelId !== channelId) {
return;
}

// always 0, 0
console.log(message.embeds.length, message.attachments.size);

// should only allow images in the channel
if (message.attachments.size === 0) {
await message.delete();
}
Example data:
https://miro.medium.com/max/1400/0*xMaFF2hSXpf_kIfG.jpg
https://miro.medium.com/max/1400/0*xMaFF2hSXpf_kIfG.jpg
nullopt
nullopt2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
Attachments too Either via the Upload file button, or copying an image into the chat box
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt2y ago
Kappa entire time the bot has been live, I didn't have that intent... Thanks for reminding me lol
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View