#Property messages does not exist on type

1 messages ยท Page 1 of 1 (latest)

short condor
#

Can't really help because the "awaits" inside brackets are awfully hard to read ๐Ÿ˜…

#

The nested ifs aren't very helpful either

#

Don't take it as a criticism, please. I just wanted to provide feedback. Clean code makes it easier for others and for you, cause you'll get the answer quicker

royal creek
#

oh wait I can set variables

#

whoops

short condor
#

Yup, that's what I meant - use variables

#

The await is fine. Just put it in a different place

warped timber
#

you need to typeguard the channel
either check <Channel>.type or use <Channel>.isTextBased()

#

I see you have ?.isTextBased but don't call it

#

also I don't believe typescript will typeguard like that

warped timber
#

you should store it in a variable first before typeguarding it

#

isTextBased() would be fine as well

royal creek
warped timber
#

yes

#

wait

#

why do you get from the cache again

royal creek
warped timber
#

use the one you stored and typeguarded

royal creek
#

oh oops

short condor
#

Why do you use an exclamation mark at the end of Client. channels.cache.get (channeldata)!?

warped timber
#

it's a non-null assertion
I assume that means either they know the channel will be there, or they want it to error if it's not
nevermind

royal creek
#

Which is a bad thing

#

because it doesn't remove the message either ๐Ÿ˜…

warped timber
#

that'd be because fetch is asynchronous, so you're comparing <Promise>.author to a User object

#

consider awaiting that promise too and also comparing ids rather than User objects

royal creek
warped timber
#

no await the fetch

#

the thing that's asynchronous

royal creek
#

already did that

warped timber
#

then that's fine
but again compare the ids instead of the User objects

warped timber
#

ye

royal creek
warped timber
#

wdym?

royal creek
warped timber
#

well that's not a referenced message

#

and no I don't believe you can access that

royal creek
#

Time to think of a way to get the author ig