Need help on a Auto role bot.
this is my current code, and it keeps giving this error when i join the server. Can I have help?
node:events:496
throw er; // Unhandled 'error' event
^
ReferenceError: member is not defined
at Client.<anonymous> (C:\Users\btrah\Desktop\Auto-Role Bot\auto-role-bot.js:16:14)
at Client.emit (node:events:518:28)
at module.exports [as GUILD_MEMBER_ADD] (C:\Users\btrah\node_modules\discord.js\src\client\websocket\handlers\GUILD_MEMBER_ADD.js:17:14)
at WebSocketManager.handlePacket (C:\Users\btrah\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
at WebSocketManager.<anonymous> (C:\Users\btrah\node_modules\discord.js\src\client\websocket\WebSocketManager.js:235:12)
at WebSocketManager.emit (C:\Users\btrah\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.<anonymous> (C:\Users\btrah\node_modules\@discordjs\ws\dist\index.js:1190:51)
at WebSocketShard.emit (C:\Users\btrah\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
at WebSocketShard.onMessage (C:\Users\btrah\node_modules\@discordjs\ws\dist\index.js:1007:14)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:92:21)
19 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!-
ReferenceError: "x" is not defined
: learn more
- TypeError: Cannot read properties of undefined/null (reading "x")
: learn moreExplain?
If you click the "learn more" link for your error, there's an explanation
Though if you're really having trouble with variable definitions, I'd heavily suggest brushing up on the fundamentals before continuing
Okay.
Ill try Thank You
You could remove that sourcebin link ASAP. Your bot token is in it
and with that in mind you should reset your token
^
Okay. Thank You guys.
(apparently I didn't scroll down far enough on mobile)
And theres no “learn more”

Oh.
Oops-
Whats it mean “member”? I dont have anything “member” in my code.
Yes you do
Line 16, inside of your guildMemberAdd
Okay.
Well how do i fix it?
By not using a variable that doesn't exist
again if you're having trouble with this, I would very heavily suggest brushing up on the fundamentals before continuing
#resources
Okay.