Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24/7 Bot crash #5649

Closed
Minecodes opened this issue May 19, 2021 · 2 comments · Fixed by #5402
Closed

24/7 Bot crash #5649

Minecodes opened this issue May 19, 2021 · 2 comments · Fixed by #5402

Comments

@Minecodes
Copy link

I coded an 24/7 bot for my AFK channel in Discord and the bot crashes after some restarts of the audio file

Error:

events.js:306
    throw err; // Unhandled 'error' event
    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. (ErrorEvent {
  target: WebSocket {
    _events: [Object: null prototype] {
      open: [Function],
      message: [Function],
      close: [Function],
      error: [Function]
    },
    _eventsCount: 4,
    _maxListeners: undefined,
    _binaryType: 'nodebuffer',
    _closeCode: 1006,
    _closeFrameReceived: false,
    _closeFrameSent: false,
    _closeMessage: '',
    _closeTimer: null,
    _extensions: {},
    _protocol: '',
    _readyState: 2,
    _receiver: null,
    _sender: null,
    _socket: null,
    _bufferedAmount: 0,
    _isServer: false,
    _redirects: 0,
    _url: 'wss://eu-central4012.discord.media/?v=4&encoding=json',
    _req: null,
    [Symbol(kCapture)]: false
  },
  type: 'error',
  message: 'connect ECONNREFUSED 162.159.138.234:443',
  error: Error: connect ECONNREFUSED 162.159.138.234:443
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '162.159.138.234',
    port: 443
  }
})
    at VoiceConnection.emit (events.js:304:17)
    at VoiceWebSocket.<anonymous> (/home/pi/AFK-Bot/node_modules/discord.js/src/client/voice/VoiceConnection.js:422:32)
    at VoiceWebSocket.emit (events.js:315:20)
    at VoiceWebSocket.onError (/home/pi/AFK-Bot/node_modules/discord.js/src/client/voice/networking/VoiceWebSocket.js:160:10)
    at WebSocket.onError (/home/pi/AFK-Bot/node_modules/ws/lib/event-target.js:140:16)
    at WebSocket.emit (events.js:315:20)
    at ClientRequest.<anonymous> (/home/pi/AFK-Bot/node_modules/ws/lib/websocket.js:579:15)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:469:9)
    at TLSSocket.emit (events.js:315:20) {
  code: 'ERR_UNHANDLED_ERROR',
  context: ErrorEvent {
    target: WebSocket {
      _events: [Object: null prototype] {
        open: [Function: onOpen] { _listener: [Function: bound onOpen] },
        message: [Function: onMessage] { _listener: [Function: bound onMessage] },
        close: [Function: onClose] { _listener: [Function: bound onClose] },
        error: [Function: onError] { _listener: [Function: bound onError] }
      },
      _eventsCount: 4,
      _maxListeners: undefined,
      _binaryType: 'nodebuffer',
      _closeCode: 1006,
      _closeFrameReceived: false,
      _closeFrameSent: false,
      _closeMessage: '',
      _closeTimer: null,
      _extensions: {},
      _protocol: '',
      _readyState: 2,
      _receiver: null,
      _sender: null,
      _socket: null,
      _bufferedAmount: 0,
      _isServer: false,
      _redirects: 0,
      _url: 'wss://eu-central4012.discord.media/?v=4&encoding=json',
      _req: null,
      [Symbol(kCapture)]: false
    },
    type: 'error',
    message: 'connect ECONNREFUSED 162.159.138.234:443',
    error: Error: connect ECONNREFUSED 162.159.138.234:443
        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
      errno: -111,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '162.159.138.234',
      port: 443
    }
  }
}
@kyranet
Copy link
Member

kyranet commented May 19, 2021

Thank you for submitting your bug report, however, you have deleted all the metadata information that came with the template, and as such, it is not easy for us to determine your version of Node.js, OS, and discord.js.

Please edit your issue to include this missing information.


As a side note, did you try the master branch? The bug you're reporting might be fixed already.

@amishshah
Copy link
Member

Hi there,

We're working on a new implementation of Discord's Voice API that has better playback quality and is more reliable than what we currently support in Discord.js v12 - check it out at https://github.com/discordjs/voice!

The new library solves many of the issues that users are facing, and as part of this, we're dropping built-in support for voice in our next major release. We have a PR (#5402) that adds native support for our new voice library - once this PR is merged, this issue will be closed.

You can still use our new voice library before that PR lands - just take a look at our music bot example to see how to get started upgrading your voice code. By using the boilerplate music player in the example, you can make it even easier to upgrade your code.

Note that the PR above only reduces some of the boilerplate code you'd otherwise have to write - you do not have to wait for the PR to be merged to start using the new voice library.


If you have any questions about this, feel free to:

  • Make an issue if you have found a bug in the new voice library
  • Use GitHub Discussions or join our Discord server (we have a new channel, #djs-new-voice, specifically for this!) to ask general questions about the library, give feedback on the library, and get support with upgrading to it

@amishshah amishshah linked a pull request Jun 9, 2021 that will close this issue
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants