#problem with client

36 messages · Page 1 of 1 (latest)

desert vessel
crude elbowBOT
#
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
weary sun
#

You shouldn’t ever export your client as it creates circular dependencies. You literally have your client as a parameter you can use

desert vessel
weary sun
#

Define not working

desert vessel
#

it says not initialized

#

in my button

weary sun
#

Show your button handler in ur interaction create

desert vessel
weary sun
#

Because you shouldn’t export import your client

#

You put it as a parameter

desert vessel
#

im trying to use an event from the client, e.g; friend:request

weary sun
#

Which you have

desert vessel
#

module.exports = { client };
here?

weary sun
#

Yes don’t do that

#

Why don’t you use the parameter client

#

As long as you’ve passed it then it’s there

desert vessel
#

wdym?

weary sun
#

I’m not too sure how to be any clearer

#

You have interaction, client as two params, as long as you’ve passed them when you call execute it should be fine

desert vessel
weary sun
#

Yes

#

That’s ur client

desert vessel
weary sun
#

Is fnBrclient an extended client?

desert vessel
weary sun
#

Did you write this code?

desert vessel
#

in fnbr.js?

#

@weary sun

weary sun
#

I’ve already told you a solution

old kiln
# desert vessel <@724935754672766988>

If you want to export you client, you need to make a subclass of the client to initialize, usually I do this inside a src folder outside of my index file to run the bot
Only then can you import the client for type checking (if you use intellisense) otherwise you will need to use either pass the client as an event arg, or you need to use the interaction to get the client, via interaction.client

eager hound
#

All of this didn’t help, because the client they talk about is not a djs client.

eager hound
weary sun
#

I did ask but I actually didn’t look at the other code 🤦🏻‍♂️ my bad

eager hound
#

And you should use readFileSync instead to make it possible

desert vessel
#

got it to work