#when is write `messsge member
1 messages ยท Page 1 of 1 (latest)
message.member?.displayHexColor
yeah what should i write?
^
this lol
do you want me to show your code?
and kudos i wouldnt have thought of that
okay lemme try
the question mark fixes
Optional chaining (?.)
The optional chaining operator (?.) enables you to read the value of a property located deep within a chain of connected objects without having to check that each reference in the chain is valid.
member is null in DM
its basically checking if the attribute exists
this is how the code looks right now, im gonna run it now
// message logger
client.on('messageCreate', (message) => {
const customTheme = chalk.hex('#000').bgHex(`${message.member?.displayHexColor}`);
const customTheme2 = chalk.hex('#000').bgHex('#fff');
const customTheme3 = chalk.hex('#828282').bgHex('#fff');
if (message.author.bot) return
// if its a guild channel
if (message.channel.type === 'GUILD_TEXT') {
console.log(customTheme(`${message.author.tag}`)+`: ${message.content} \n`);
}
// if no role color or role color is black
if (message.member.displayHexColor === '#000000') {
console.log(customTheme2(`${message.author.tag}`)+`: ${message.content} \n`);
}
// if channel type is dms
if (message.channel.type === 'DM') {
console.log(customTheme3(`${message.author.tag}`)+`: ${message.content} \n`);
}
});
wut
is x offline
wdym?
is the old status offline
either way
if im going offline or coming online
the docs are severely outdated
holy shit
wut
theres code in the docs that just completely doesnt work anymore
@oblique scaffold thankyou so so much friend
๐
which code
i lost the code i copied lmao fml
so you don't remember which part of the docs and you don't have the code you copied?
ive written new code 20x between copying and now
oldmember always null
no matter what i do
what djs version are you using
v13
- what

What intents are you subscribing to?
and catches events
npm ls discord.js in terminal
you know presenceUpdate gives presence instances? Not guildMember instances
Oh yea
but that shouldnt change the fact its null regardless of going online or not?
offline presences are just null
do await guild.members.fetch({ withPresences: true })
still null
one second
your PresenceManager has 0, so there is no presence to give
is it fixed ๐
loll
I barely even use djs lol
it dont wanna set my rpc tho
sucks
it works on button presses
it just doesnt wanna do it when i restart discord app
well that still sucks
it's logging Online?