ZerioDev / Music-bot

A complete code to download for a cool Discord music bot !
https://discord.gg/5cGSYV8ZZj
GNU General Public License v3.0
864 stars 1.05k forks source link

The bot won't play music #276

Closed G-IDEON closed 6 months ago

G-IDEON commented 1 year ago

I start the bot, there're no errors, everything is ok. When I enter the play command and specify the music, the bot writes what it adds to the queue, connects to the channel, and the text is immediately sent: No more songs in the queue! As a result, the music doesn't turn on. There're no errors in the console. I noticed that it periodically starts the song, but most often it doesn't work with the answer that I indicated earlier. Let's say if I enter the name of the track or a link to it, then it doesn't play it, as described above, but if I write a couple of random letters, then it turns on some random music and works

G-IDEON commented 1 year ago

The only thing I could catch from the logs was when I tried to include another track from the YouTube link:

main > ReferenceError: track is not defined 
││ main >     at module.exports (/bot/musicbot/events/Player/error.js:
││ main >     at PlayerEventsEmitter.emit (node:events:513:28)
││ main >     at PlayerEventsEmitter.emit (/bot/musicbot/node_modules/
││ main >     at StreamDispatcher.<anonymous> (/bot/musicbot/node_modu
││ main >     at StreamDispatcher.emit (node:events:513:28)
││ main >     at StreamDispatcher.playStream (/bot/musicbot/node_modul
││ main >     at runMicrotasks (<anonymous>)
││ main >     at processTicksAndRejections (node:internal/process/task_queues:96:5)
││ main >     at async GuildQueuePlayerNode.#performPlay (/bot/musicbot/node_modules/discord-player/dist/index .js
││ main >     at async GuildQueuePlayerNode.play (/bot/musicbot/node_modules/discord-player/dist/index.js:1045

Or

/bot/musicbot/events/Player/error.js:6
    .setAuthor({name: `The bot has encountered an unexpected error, report it to the Developers!`, iconURL: track.thumbnail})
                                                                                                                     ^

ReferenceError: track is not defined
    at module.exports (/bot/musicbot/events/Player/error.js:6:118)
    at PlayerEventsEmitter.emit (node:events:513:28)
    at PlayerEventsEmitter.emit (/bot/musicbot/node_modules/discord-player/dist/index.js:207:18)
    at StreamDispatcher.<anonymous> (/bot/musicbot/node_modules/discord-player/dist/index.js:1659:52)
    at StreamDispatcher.emit (node:events:513:28)
    at StreamDispatcher.playStream (/bot/musicbot/node_modules/discord-player/dist/index.js:2357:26)
    at async GuildQueuePlayerNode.#performPlay (/bot/musicbot/node_modules/discord-player/dist/index.js:1059:3)
    at async GuildQueuePlayerNode.play (/bot/musicbot/node_modules/discord-player/dist/index.js:1045:7)
    at async Object.execute (/bot/musicbot/commands/music/play.js:59:33)

I also see that when requesting history (with the /history command) there is music that is not playing, and it is indicated that the request type is via Spotify, and the link to the track is YouTube, although I have the spotifyBridge parameter set to false in my config

At the same time, tracks that have successfully played and ended are not displayed in / history

Track {
    requestedBy: User {
      id: '312873639248658432',
      bot: false,
      system: false,
      flags: [UserFlagsBitField],
      username: 'GIDEON',
      discriminator: '2518',
      avatar: '45cbe782cd4db9422d14b97b34081472',
      banner: undefined,
      accentColor: undefined
    },
    queryType: 'spotifySong',
    raw: {
      source: 'spotify',
      title: 'Back In Black',
      description: 'Back In Black by AC/DC',
      author: 'AC/DC',
      url: 'https://www.youtube.com/watch?v=pAgnJDJN4VA',
      thumbnail: 'https://i.scdn.co/image/ab67616d0000b2730b51f8d91f3a21e8426361ae',
      duration: '04:15',
      views: 0,
      requestedBy: [User],
      queryType: 'spotifySong'
    },

Also in the configuration, the option to access only when role present is enabled (true), but still everyone can use it.

 DJ: {
            enabled: true,
            roleName: 'DJ',
itsjustyryr commented 1 year ago

Hi! Use the beta branch, as the main one is broken.