Adding role to a user
I have a function that should add a role to a user.
I am calling it using this line:
And I am also import client from the index.js file which module.exports the client. But When running that function I get this error:
Error assigning role: Cannot read properties of undefined (reading 'cache')
(node:41004) Warning: Accessing non-existent property 'guilds' of module exports inside circular dependency
(Use
node --trace-warnings ...
to show where the warning was created)4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- 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 OPWhat do you mean by, What is the context you call that function in?
It's a function for a function which is for a command
The full code: https://pastebin.com/jvQA51ak
Pastebin
const { createClient } = require('@supabase/supabase-js');const { s...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
from a command file
I tried putting the assignRole function in the index.js file and importing that but then I get the error: Error choosing participants: assignRole is not a function
Error assigning role: Cannot read properties of undefined (reading 'cache')
(node:1452) Warning: Accessing non-existent property 'guilds' of module exports inside circular dependency
(Use
node --trace-warnings ...
to show where the warning was created)
Oh, I got it working
I just needed to pass the client to the assignRole function