#Cannot read properties of null (reading 'id')

14 messages · Page 1 of 1 (latest)

odd herald
#

Hey, so I have a code that worked everytime, but now not longer...
Version: 14.11.0

    if (activeRounds[channel.id]) {
                             ^
TypeError: Cannot read properties of null (reading 'id')
    at Object.execute (/home/container/src/commands/guesspic.js:42:30)
    at module.exports (/home/container/src/events/interactionCreate.js:6:13)
    at BoilerplateClient.emit (node:events:512:28)
    at InteractionCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/InteractionCreate.js:97:12)
    at module.exports [as INTERACTION_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:354:31)
    at WebSocketManager.<anonymous> (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:238:12)
    at WebSocketManager.emit (/home/container/node_modules/@vladfrangu/async_event_emitter/dist/index.js:282:31)
    at WebSocketShard.<anonymous> (/home/container/node_modules/@discordjs/ws/dist/index.js:1103:51)
    at WebSocketShard.emit (/home/container/node_modules/@vladfrangu/async_event_emitter/dist/index.js:282:31)```
marble flaxBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Explain what exactly your issue is.
  • Not a discord.js issue? Check out #useful-servers.
  • Issue solved? Press the button!
odd herald
#

Code: ```js
const category = interaction.options.getString('category');
const channel = interaction.channel;

const pro = new EmbedBuilder()
  .setColor('#35393e')
  .setTitle('![kenon_time](https://cdn.discordapp.com/emojis/1112837885696155759.webp?size=128 "kenon_time") 〢 Slow down!')
  .setDescription(`There's still a Round in progress.`);

// Check if a round is already in progress in the channel
if (activeRounds[channel.id]) {
  // Send an invisible message to inform that a round is still running
  await interaction.reply({ embeds: [pro], ephemeral: true });
  return;
}

// Mark the channel as having an active round
activeRounds[channel.id] = true;```

If more is needed to help, please ping me

meager patio
#

Could you confirm your version with npm i discord.js?

odd herald
#

still the same

rare zealot
#

is the command being executed in a dm?

sage mulch
#

do you have the guilds intent or ^

odd herald
odd herald
#

I guess I have to beg discord to give me the guilds intent since I only got the message content intent

sage mulch
#

you just have to enable it in your client?

#

Its not a privileged intent

odd herald