#TypeError: Cannot create property 'audioPlayer' on string 'study'

36 messages · Page 1 of 1 (latest)

covert idol
#

Hello so I noticed something my bot crashes after a while because of the module. I'd like to know how to prevent it from crashing.

C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:1112
    resource.audioPlayer = this;
                         ^

TypeError: Cannot create property 'audioPlayer' on string 'study'
    at AudioPlayer.play (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:1112:26)
    at AudioPlayer.<anonymous> (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\events\client\ready.js:74:33)
    at AudioPlayer.emit (node:events:513:28)
    at set state [as state] (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:1083:12)
    at AudioPlayer.checkPlayable (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:1224:18)
    at C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:126:60
    at Array.filter (<anonymous>)
    at audioCycleStep (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:126:34)
    at Timeout.<anonymous> (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:137:45)
    at listOnTimeout (node:internal/timers:569:17)

Node.js v18.16.0
sharp muralBOT
#

• 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.

covert idol
#
TypeError: Cannot create property 'audioPlayer' on string 'boy'
    at AudioPlayer.play (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:1112:26)
    at AudioPlayer.<anonymous> (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\events\client\ready.js:74:33)
    at AudioPlayer.emit (node:events:513:28)
    at set state [as state] (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:1083:12)
    at AudioPlayer.checkPlayable (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:1224:18)
    at C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:126:60
    at Array.filter (<anonymous>)
    at audioCycleStep (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:126:34)
    at Timeout.<anonymous> (C:\Users\xiaotox.fr\Documents\GitHub\SoundCord\node_modules\@discordjs\voice\dist\index.js:137:45)
    at listOnTimeout (node:internal/timers:569:17)

Node.js v18.16.0
meager turret
#

By not passing a string to <AudioPlayer>.play(…) but an AudioResource

covert idol
meager turret
#

Your error suggests otherwise. At least at one place you pass a string instead

covert idol
meager turret
covert idol
#

le audioStream

#
let audioStream = await playdl.stream(RadioMap.get(db.radio)); ```
meager turret
#

… please read what I said…

covert idol
#

how can I understand you if I can't understand your sentences?

meager turret
#

By asking about the part you don’t understand… do you understand what <AudioPlayer>.play(…) means?

#

Show me all places where you use that in your code

covert idol
meager turret
#

And what’s db.radio defined as? It‘s not an AudioResource is it?

covert idol
meager turret
#

So you pass a string to <AudioPlayer>.play(…), which is invalid. It only accepts AudioResource

covert idol
#

because I pass him my AudioRessource it's in the audio resource that I pass the db.Radio

meager turret
covert idol
oak quarryBOT
#

method AudioPlayer#play()
Plays a new resource on the player. If the player is already playing a resource, the existing resource is destroyed (it cannot be reused, even in another player) and is replaced with the new resource.

meager turret
#

That method only accepts one parameter of type AudioResource. So make sure you pass one and not a string

#

And I did explain that before. I‘m not responsible for making you understand. You are the one seeking help, the burden of asking helpful questions is on you. #how-to-get-help

covert idol
meager turret
#

Umm, you give it a parameter whose value is a string. So you give it a string

covert idol
meager turret
#

You don’t pass it an AudioResource! You pass it db.radio and you said yourself that that is a string

covert idol
meager turret
covert idol
#

I had modified after yesterday, but today the error persists.

#

i have replace db.radio with ressource

meager turret
#

Show your full code you currently have. It’s literally impossible for me to know what you changed and to help you fix your issue

nocturne harness
#
  • const connection = joinVoiceChannel(...)

  • const { player } = connection.subscribe(createAudioPlayer(...))

  • player.play(createAudioResource(...))

meager turret