I have a Discord.js Message instance, which, as defined in the documentation, should have a .cleanContent
property, and it should be a string.
console.log(message.cleanContent)
works as intended, butconsole.log(message)
does not log the cleanContent
property.Object.keys(message)
does not discover the cleanContent
property.JSON.parse(JSON.stringify(message))
has a loggable, visible cleanContent
in turn.for(key in message)
loop also does not list the .cleanContent
.So, uh.. what is going on here?
The bug is reproducable with this much code:
client.on("messageCreate", (message) => {
console.log(Object.keys(message))
})
This is due to the fact that it's a getter, as shown here. Getters don't seem to be logged in node.js, unlike in my browser's developer console (Chrome). Getters are different in different environments, so it's difficult to provide a solution.