eritislami / evobot

🤖 EvoBot is a Discord Music Bot built with TypeScript + Discord.js, includes Docker builds & localization in 20+ languages
MIT License
1.85k stars 2.02k forks source link

Server issues when /play command is used. 'Missing Access' error from Discord API🐛 #1388

Closed mattgrunwald closed 1 year ago

mattgrunwald commented 1 year ago

Describe the bug Server crashes when asked to play a song.

How To Reproduce Steps to reproduce the behavior:

  1. run docker run -it --rm -e TOKEN="$TOKEN" eritislami/evobot
  2. Add the bot to your server with message content intent
  3. Add permissions you think it needs, (bot and applications.commands scopes), Manage messages, voice connect and speak)
  4. in your server, run /play mr blue sky

Expected behavior Bot enters voice chat and plays the song

Environment (add if possible)

Additional information & screenshots Here's the logs of the container:

music_bot ready!
WARNING: ytdl-core is out of date! Update with "npm install ytdl-core@latest".
DiscordAPIError[50001]: Missing Access
    at SequentialHandler.runRequest (/home/evobot/node_modules/@discordjs/rest/dist/index.js:667:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/home/evobot/node_modules/@discordjs/rest/dist/index.js:464:14)
    at async REST.request (/home/evobot/node_modules/@discordjs/rest/dist/index.js:910:22)
    at async TextChannel.send (/home/evobot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:176:15)
    at async MusicQueue.sendPlayingMessage (/home/evobot/dist/structs/MusicQueue.js:158:30) {
  requestBody: {
    files: [],
    json: {
      content: '🎶 Started playing: **Mr. Blue Sky** https://www.youtube.com/watch?v=wuJIqmha2Hk',
      tts: false,
      nonce: undefined,
      embeds: undefined,
      components: undefined,
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: undefined,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined,
      thread_name: undefined
    }
  },
  rawError: { message: 'Missing Access', code: 50001 },
  code: 50001,
  status: 403,
  method: 'POST',
  url: 'https://discord.com/api/v10/channels/<channel id omitted>/messages'
}
/home/evobot/node_modules/@discordjs/rest/dist/index.js:667
        throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
              ^

DiscordAPIError[50001]: Missing Access
    at SequentialHandler.runRequest (/home/evobot/node_modules/@discordjs/rest/dist/index.js:667:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/home/evobot/node_modules/@discordjs/rest/dist/index.js:464:14)
    at async REST.request (/home/evobot/node_modules/@discordjs/rest/dist/index.js:910:22)
    at async TextChannel.send (/home/evobot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:176:15) {
  requestBody: {
    files: [],
    json: {
      content: 'Missing Access',
      tts: false,
      nonce: undefined,
      embeds: undefined,
      components: undefined,
      username: undefined,
      avatar_url: undefined,
      allowed_mentions: undefined,
      flags: undefined,
      message_reference: undefined,
      attachments: undefined,
      sticker_ids: undefined,
      thread_name: undefined
    }
  },
  rawError: { message: 'Missing Access', code: 50001 },
  code: 50001,
  status: 403,
  method: 'POST',
  url: 'https://discord.com/api/v10/channels/<channel id omitted>/messages'
}

I've tried allowing all other permissions (except administrator) and all other intents, I still keep getting this error

mattgrunwald commented 1 year ago

I've also tried updating ytdl-core and that doesn't seem to help

eritislami commented 1 year ago

Nothing to do with ytdl-core, its missing permissions to send messages

mattgrunwald commented 1 year ago

snip

These are the permissions I'm giving the bot. Shouldn't it be able to send messages then?

mattgrunwald commented 1 year ago

For more context the bot can send messages in its current state in my server. Using /lyrics causes the bot to send a correct message that there's nothing currently playing. For some reason the crash is happening when the bot tries to send the message with all the control reactions.

When I try to use /play the bot does indeed join the right voice channel and the song says for half a second before cutting out.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.