#when is write `messsge member

1 messages ยท Page 1 of 1 (latest)

sick lava
#

t

#

lets write here

oblique scaffold
#

message.member?.displayHexColor

sick lava
#

that works

#

@gloomy axle

gloomy axle
#

yeah what should i write?

oblique scaffold
sick lava
gloomy axle
#

do you want me to show your code?

sick lava
sick lava
#

just type the thing myth sent

gloomy axle
#

okay lemme try

sick lava
#

the question mark fixes

lofty cairnBOT
#

mdn 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.

oblique scaffold
#

member is null in DM

sick lava
#

its basically checking if the attribute exists

gloomy axle
#

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`);
  }
});
sick lava
#

perf

#

@oblique scaffold can i ask you summin

oblique scaffold
#

wut

sick lava
#

why is x (used to be oldguildmember) always null

oblique scaffold
#

is x offline

sick lava
#

wdym?

oblique scaffold
sick lava
#

either way

#

if im going offline or coming online

#

the docs are severely outdated

#

holy shit

oblique scaffold
#

wut

gloomy axle
#

thankyou it worked

#

THANKS THANKS THANKS

sick lava
#

theres code in the docs that just completely doesnt work anymore

gloomy axle
sick lava
#

but gg

gloomy axle
#

@oblique scaffold thankyou so so much friend

oblique scaffold
#

๐Ÿ‘

sick lava
#

i lost the code i copied lmao fml

oblique scaffold
#

so you don't remember which part of the docs and you don't have the code you copied?

sick lava
#

ive written new code 20x between copying and now

#

oldmember always null

#

no matter what i do

oblique scaffold
sick lava
#

v13

oblique scaffold
sick lava
#

so fun fact

#

i have no djs

#

but its been doing everything

#

LOL

oblique scaffold
sick lava
#

it logs into my bot just fine

#

sends msgs

gilded stratus
sick lava
#

and catches events

oblique scaffold
#

npm ls discord.js in terminal

sick lava
#

apparently im a wizard

oblique scaffold
sick lava
#

yea

gilded stratus
#

Oh yea

sick lava
#

but that shouldnt change the fact its null regardless of going online or not?

oblique scaffold
#

offline presences are just null

sick lava
#

yes but its not offline, its null

#

and offline gives a presence btw

oblique scaffold
#

do await guild.members.fetch({ withPresences: true })

sick lava
#

still null

oblique scaffold
#

one second

oblique scaffold
oblique scaffold
sick lava
#

oh my fucking god

#

lmfao

oblique scaffold
#

is it fixed ๐Ÿ‘€

sick lava
#

thats so fucking dumb

#

yea

oblique scaffold
#

loll

sick lava
#

thats embarrassing

#

working 60 hrs per week with djs for a full year

#

hahahah

oblique scaffold
#

I barely even use djs lol

sick lava
#

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

oblique scaffold
#

it's logging Online?

sick lava
#

yea it all works

#

and it also logs online 2

#

its just not setting my rpc

#

i think i need to relog with rpc

#

bruh

#

what the fuck lmao