Search code examples
discordbotsaudio-playerreplit

Discord Music Bot: Cannot read properties of undefined


I have completed my bot. When I try to run a command such as /play (LINK) it is stuck thinking. After a brief moment the bot will return this error in the console and stops running:

TypeError: Cannot read properties of undefined (reading 'voice')
    at Object.run (/home/runner/Comusity-Bot/slash/play.js:29:66)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
repl process died unexpectedly: exit status 1

Code:

const queue = await client.player.createQueue(interaction.guild)
  if (!queue.connection) await queue.connect(interaction.memeber.voice.channel)

Repl.it: https://replit.com/@TylerLanier/Comusity-Bot#slash/play.js:29:66


Solution

  • As someone else pointed out, you have a typo. You are searching for memeber when it should be member.