#cannot read property of null

13 messages · Page 1 of 1 (latest)

wheat vaporBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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 staff
devout wind
#

and it returns the following

#
TypeError: Cannot read properties of null (reading 'value')
    at Object.run (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\src\commands\moderation\warn.js:31:76)
    at Client.<anonymous> (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\node_modules\commandkit\dist\index.js:643:67)
    at Client.emit (node:events:514:28)
    at InteractionCreateAction.handle (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)      
    at module.exports [as INTERACTION_CREATE] (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\node_modules\discord.js\src\client\websocket\WebSocketManager.js:355:31)     
    at WebSocketManager.<anonymous> (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\node_modules\discord.js\src\client\websocket\WebSocketManager.js:239:12)      
    at WebSocketManager.emit (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
    at WebSocketShard.<anonymous> (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\node_modules\@discordjs\ws\dist\index.js:1190:51)
    at WebSocketShard.emit (C:\Users\yusuf\Documents\programming projects\discordbots\tristonstickets\developmentCode\node_modules\@vladfrangu\async_event_emitter\dist\index.cjs:287:31)
#

^^^^^^ file

#

I thought the following function meant that if the first option was null, then it would go with the latter

#
(interaction.options.get("reason").value || "No reason provided")
quartz niche
#

an option can be null

#

and why arent you using the proper methods

#

such as getString

devout wind
#

i thought you do .get()

#

for everything