I used to have a line of code that would listen for a answer in a command option and it included .tolowerCase but now it doesnt work and just makes my bot crash here is the old code
if (interaction.options.getString("favourite-pet").toLowerCase() === "dog") {
const embed = new EmbedBuilder()
.setTitle("No way dogs my fav too")
.setDescription(" i cant believe we both love dogs")
.setColor("Orange");
interaction.reply({ embeds: })
}
but now including the .tolowercase returns this in the terminal
node:events:496
throw er; // Unhandled ‘error’ event
^
TypeError: Cannot read properties of null (reading ‘toLowerCase’)
at Client. (D:Gababes botsrcindex.js:189:49)
at Client.emit (node:events:530:35)
at InteractionCreateAction.handle (D:Gababes botnode_modulesdiscord.jssrcclientactionsInteractionCreate.js:97:12)
at module.exports [as INTERACTION_CREATE] (D:Gababes botnode_modulesdiscord.jssrcclientwebsockethandlersINTERACTION_CREATE.js:4:36)
at WebSocketManager.handlePacket (D:Gababes botnode_modulesdiscord.jssrcclientwebsocketWebSocketManager.js:355:31)
at WebSocketManager. (D:Gababes botnode_modulesdiscord.jssrcclientwebsocketWebSocketManager.js:239:12)
at WebSocketManager.emit (D:Gababes botnode_modules@vladfranguasync_event_emitterdistindex.cjs:282:31)
at WebSocketShard. (D:Gababes botnode_modules@discordjswsdistindex.js:1173:51)
at WebSocketShard.emit (D:Gababes botnode_modules@vladfranguasync_event_emitterdistindex.cjs:282:31)
at WebSocketShard.onMessage (D:Gababes botnode_modules@discordjswsdistindex.js:988:14)
Emitted ‘error’ event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:401:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)