I have an error that I cannot solve.

So I have a warn.js file that has an error. The file is https://sourceb.in/6Hrc2IpLUt and the error is: TypeError: Cannot read properties of null (reading 'id') at Object.execute (D:\Happybottesttobeofficial\slashcommands\warn.js:26:89) at Client.<anonymous> (D:\Happybottesttobeofficial\index.js:52:19) at Client.emit (node:events:520:28) at InteractionCreateAction.handle (D:\Happybottesttobeofficial\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12) at module.exports [as INTERACTION_CREATE] (D:\Happybottesttobeofficial\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36) at WebSocketManager.handlePacket (D:\Happybottesttobeofficial\node_modules\discord.js\src\client\websocket\WebSocketManager.js:348:31) at WebSocketManager.<anonymous> (D:\Happybottesttobeofficial\node_modules\discord.js\src\client\websocket\WebSocketManager.js:232:12) at WebSocketManager.emit (D:\Happybottesttobeofficial\node_modules@vladfrangu\async_event_emitter\dist\index.cjs:287:31) at WebSocketShard.<anonymous> (D:\Happybottesttobeofficial\node_modules@discordjs\ws\dist\index.js:1190:51) at WebSocketShard.emit (D:\Happybottesttobeofficial\node_modules@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
27 Replies
d.js toolkit
d.js toolkit3mo ago
- 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 OP
treble/luna
treble/luna3mo ago
Seems like member is null Which mean no member was passed in or they arent in the guild or interaction.guild is null, meaning its a dm command, a user app, or you dont have the Guilds intent
BMmarci1234
BMmarci1234OP3mo ago
I have a test server with 10 bots and 3 including me real person. I think I have the guild intent but let me check Does these intents enough to have? GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent And if you want to know thats my index.js https://sourceb.in/ZEaHFCYtto And the prefix command that is the same js not slashcommandbuilder is working. https://sourceb.in/Wde3wYOhst
treble/luna
treble/luna3mo ago
Then this Log to confirm
BMmarci1234
BMmarci1234OP3mo ago
What does member is null mean? And I now tried to do with a bot that has 0 permission. Like the permission code is 0 And the same error appeared.
treble/luna
treble/luna3mo ago
The member isnt in the server But as long as you dont log it to make sure, i cant help you
BMmarci1234
BMmarci1234OP3mo ago
The member is on the server I am trying to warn plus thats the code thats prefix and it works What do you mean log it?
treble/luna
treble/luna3mo ago
Console log it
BMmarci1234
BMmarci1234OP3mo ago
Like show the console?
treble/luna
treble/luna3mo ago
do you not know how to use console.log?
BMmarci1234
BMmarci1234OP3mo ago
I do sir.
treble/luna
treble/luna3mo ago
Then do so And log member
BMmarci1234
BMmarci1234OP3mo ago
Just that. Alright. One sec lemme try. Ah Got the problem Executing warn command Member object: null Reason: rew Member not found That's the console.log So The member isn't even a member So can the problem be solved if I warn a normal member. ?
treble/luna
treble/luna3mo ago
yes
BMmarci1234
BMmarci1234OP3mo ago
Alright. And does bots with 0 permission count?
treble/luna
treble/luna3mo ago
anyone that is a member of the server
BMmarci1234
BMmarci1234OP3mo ago
And not a bot right? Alright. Thanks for helping. But another question.
treble/luna
treble/luna3mo ago
Bots are also members
BMmarci1234
BMmarci1234OP3mo ago
This command doesn't work either. https://sourceb.in/WAkpD6k6XZ I assume it has the same problem. Do they have to be online?
treble/luna
treble/luna3mo ago
No Doesnt work in what way? If its the same error then yes
BMmarci1234
BMmarci1234OP3mo ago
Then, I have a bot not online and it says this in the console. Executing warn command Member object: null Reason: 1 Member not found Yeah it is the same error. But even when I console.log it It says this to a bot that isnt online Executing warn command Member object: null Reason: 1 Member not found and has 0 permission.
treble/luna
treble/luna3mo ago
Then the bot isnt in the server (or does not have the bot scope)
BMmarci1234
BMmarci1234OP3mo ago
Oh alright.
treble/luna
treble/luna3mo ago
You dont leave a server when you go offline
BMmarci1234
BMmarci1234OP3mo ago
Thanks for your help.
treble/luna
treble/luna3mo ago
So neither do bots
BMmarci1234
BMmarci1234OP3mo ago
But the bot is on the server. nvm have a nice day bye
Want results from more Discord servers?
Add your server