Open
Description
Which package is this bug report for?
discord.js
Issue description
- Create a bot without GUILDS intent.
- Get a guild member
- call
member.displayHexColor
- Get an error
The problem here is not inherently with getting an error, but rather with the fact that the error is hard to understand for someone who has no idea that they are missing the GUILDS intent. They might try to console log, but will only get this error again, not undefined or anything. I fully believe this is very confusing and there should be a check for the guilds intent (or if the roles cache is empty) that throws with the message that the GUILDS intent is missing.
Code sample
const client = new Client({
intents: [],
})
client.on('interactionCreate, async (interaction) => {
if (!interaction.member || interaction.member === undefined) { return; }
console.log(interaction?.member?.displayHexColor) // This will error
})
Package version
13.8.1
Node.js version
17.5.0
Operating system
Linux Manjaro
Priority this issue should have
Low (slightly annoying)
Which partials do you have configured?
Not applicable (subpackage bug)
Which gateway intents are you subscribing to?
No Intents
I have tested this issue on a development release
No response