#problem with client
36 messages · Page 1 of 1 (latest)
- 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
You shouldn’t ever export your client as it creates circular dependencies. You literally have your client as a parameter you can use
its not working in my button tho
Define not working
it says not initialized
in my button
Show your button handler in ur interaction create
my button works, but fnbrClient wont work in the button
Because you shouldn’t export import your client
You put it as a parameter
im trying to use an event from the client, e.g; friend:request
Which you have
module.exports = { client };
here?
Yes don’t do that
Why don’t you use the parameter client
As long as you’ve passed it then it’s there
wdym?
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
in run: async (client, interaction) => {} right?
Yes
That’s ur client
yes thats my discord client
Is fnBrclient an extended client?
i dont think so
Did you write this code?
in fnbr.js?
@weary sun
I’ve already told you a solution
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
All of this didn’t help, because the client they talk about is not a djs client.
You can’t export a let variable, it should be a const that you define outside of your async IIFE. The login call can be done inside that IIFE though
I did ask but I actually didn’t look at the other code 🤦🏻♂️ my bad
And you should use readFileSync instead to make it possible
got it to work