TypeError: Cannot read properties of undefined (reading 'client')
Full Error:
Code: (utils.js line 129 to 131)
6 Replies
Please show the full file.
whole file or only the specific function
The full file
since my code is closed source, I can send you the password of a pastebin
Ok
Ok, that's what I thought. If you directly call a standalone function from within a class method,
this
inside the standalone function will not refer to the class instance. Instead, it will refer to undefined
.
The easiest way is to import container
from @sapphire/framework
and use it directly instead of through this
.
The harder ways would be to input the container via parameter, or do handleError.call(this)
in the method, which explicitly sets the value of this
.ohhh
this is why I shouldn't code at night
ty