SushiBtw / discord-music-player

Complete framework to facilitate music commands using discord.js v14 & v13.
https://discord-music-player.js.org/
MIT License
157 stars 65 forks source link

[BUG] TypeError: Cannot read property 'options' of undefined #301

Closed BallisticOK closed 2 years ago

BallisticOK commented 2 years ago

I'm getting TypeError: Cannot read property 'options' of undefined on

.on('songFirst', (queue, song) => queue.data.channel({ embeds: [new MessageEmbed().setColor('#0099ff').setTitle(song + ' is now playing!')]}))

SushiBtw commented 2 years ago

Where does the error occurre? Can I see the full stack trace?

BallisticOK commented 2 years ago

this is my hole error

TypeError: Cannot read property 'options' of undefined at MessagePayload.resolveData (/home/container/node_modules/discord.js/src/structures/MessagePayload.js:166:30) at Object.send [as channel] (/home/container/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:61) at Player. (/home/container/index.js:208:20) at Player.emit (node:events:394:28) at Queue.play (/home/container/node_modules/discord-music-player/dist/managers/Queue.js:222:25) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Object.run (/home/container/commands/music/play.js:63:24) at async Query. (/home/container/events/messageCreate.js:173:4) Promise {

TypeError: Cannot read property 'options' of undefined at MessagePayload.resolveData (/home/container/node_modules/discord.js/src/structures/MessagePayload.js:166:30) at Object.send [as channel] (/home/container/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:61) at Player. (/home/container/index.js:208:20) at Player.emit (node:events:394:28) at Queue.play (/home/container/node_modules/discord-music-player/dist/managers/Queue.js:222:25) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Object.run (/home/container/commands/music/play.js:63:24) at async Query. (/home/container/events/messageCreate.js:173:4) }
SushiBtw commented 2 years ago

You are missing #send() method after queue.data.channel.

BallisticOK commented 2 years ago

ok give sec

BallisticOK commented 2 years ago

i got TypeError: queue.data.channel.send is not a function at Player. (/home/container/index.js:220:28) at Player.emit (node:events:394:28) at StreamConnection. (/home/container/node_modules/discord-music-player/dist/managers/Queue.js:149:29) at StreamConnection.emit (node:events:394:28) at AudioPlayer. (/home/container/node_modules/discord-music-player/dist/voice/StreamConnection.js:85:26) at AudioPlayer.emit (node:events:394:28) at AudioPlayer.set state [as state] (/home/container/node_modules/discord-music-player/node_modules/@discordjs/voice/dist/index.js:933:10) at Encoder.onReadableCallback (/home/container/node_modules/discord-music-player/nodemodules/@discordjs/voice/dist/index.js:974:22) at Object.onceWrapper (node:events:513:28) at Encoder.emit (node:events:406:35) at emitReadable (node:internal/streams/readable:573:12) at processTicksAndRejections (node:internal/process/task_queues:82:21) uncaughtException

.on('songFirst',  (queue, song) =>
    queue.data.channel.send({ embeds: [new MessageEmbed().setColor('#0099ff').setTitle(song + ' is now playing!')]}))
SushiBtw commented 2 years ago

What js queue.data.channel?

BallisticOK commented 2 years ago

idk im trying to fix up my bot after my dev left

BallisticOK commented 2 years ago

but if your talking about this

let queue = client.player.createQueue(message.guild.id, { data: { channel: message.channel.send, }}); then that

SushiBtw commented 2 years ago

remove send at the end

BallisticOK commented 2 years ago

ok give sec

BallisticOK commented 2 years ago

it now cant join the VC and i get

reject Promise { [ { status: 'connecting', adapter: [Object], networking: [Networking] }, { status: 'ready', adapter: [Object], networking: [Networking] } ] } AbortError: The operation was aborted at abortListener (node:events:842:14) at EventTarget. (node:events:878:47) at EventTarget.[nodejs.internal.kHybridDispatch] (node:internal/event_target:460:20) at EventTarget.dispatchEvent (node:internal/event_target:405:26) at abortSignal (node:internal/abort_controller:98:10) at AbortController.abort (node:internal/abort_controller:123:5) at entersState (/home/container/node_modules/discord-music-player/node_modules/@discordjs/voice/dist/index.js:2004:11) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Queue.join (/home/container/node_modules/discord-music-player/dist/managers/Queue.js:130:26) at async Object.run (/home/container/commands/music/play.js:62:13) at async Query. (/home/container/events/messageCreate.js:173:4) { code: 'ABORT_ERR' } ————————————————————————————————— [ AntiCrash ] : Multiple Resolves ————————————————————————————————— reject Promise { { ip: 'MY IP', port: 48167 } } Error: Cannot perform IP discovery - socket closed at Socket. (/home/container/node_modules/discord-music-player/node_modules/@discordjs/voice/dist/index.js:351:46) at Object.onceWrapper (node:events:513:28) at Socket.emit (node:events:406:35) at socketCloseNT (node:dgram:755:8) at processTicksAndRejections (node:internal/process/task_queues:82:21)

BallisticOK commented 2 years ago

ok so i got it to play and join the VC but i still get this

reject Promise { [ { status: 'connecting', adapter: [Object], networking: [Networking] }, { status: 'ready', adapter: [Object], networking: [Networking] } ] } AbortError: The operation was aborted at abortListener (node:events:842:14) at EventTarget.<anonymous> (node:events:878:47) at EventTarget.[nodejs.internal.kHybridDispatch] (node:internal/event_target:460:20) at EventTarget.dispatchEvent (node:internal/event_target:405:26) at abortSignal (node:internal/abort_controller:98:10) at AbortController.abort (node:internal/abort_controller:123:5) at entersState (/home/container/node_modules/discord-music-player/node_modules/@discordjs/voice/dist/index.js:2004:11) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Queue.join (/home/container/node_modules/discord-music-player/dist/managers/Queue.js:130:26) at async Object.run (/home/container/commands/music/play.js:62:13) at async Query.<anonymous> (/home/container/events/messageCreate.js:173:4) { code: 'ABORT_ERR' }